diff options
131 files changed, 1770 insertions, 505 deletions
diff --git a/arch/arm/configs/n8x0_defconfig b/arch/arm/configs/n8x0_defconfig index 216ad00948af..9405e32783de 100644 --- a/arch/arm/configs/n8x0_defconfig +++ b/arch/arm/configs/n8x0_defconfig | |||
| @@ -1058,7 +1058,6 @@ CONFIG_JFFS2_CMODE_PRIORITY=y | |||
| 1058 | # CONFIG_ROMFS_FS is not set | 1058 | # CONFIG_ROMFS_FS is not set |
| 1059 | # CONFIG_SYSV_FS is not set | 1059 | # CONFIG_SYSV_FS is not set |
| 1060 | # CONFIG_UFS_FS is not set | 1060 | # CONFIG_UFS_FS is not set |
| 1061 | # CONFIG_NILFS2_FS is not set | ||
| 1062 | CONFIG_NETWORK_FILESYSTEMS=y | 1061 | CONFIG_NETWORK_FILESYSTEMS=y |
| 1063 | # CONFIG_NFS_FS is not set | 1062 | # CONFIG_NFS_FS is not set |
| 1064 | # CONFIG_NFSD is not set | 1063 | # CONFIG_NFSD is not set |
diff --git a/arch/arm/configs/omap_zoom2_defconfig b/arch/arm/configs/omap_zoom2_defconfig index f5c6e11cf189..881faea03d79 100644 --- a/arch/arm/configs/omap_zoom2_defconfig +++ b/arch/arm/configs/omap_zoom2_defconfig | |||
| @@ -661,7 +661,7 @@ CONFIG_DEVKMEM=y | |||
| 661 | CONFIG_SERIAL_8250=y | 661 | CONFIG_SERIAL_8250=y |
| 662 | CONFIG_SERIAL_8250_CONSOLE=y | 662 | CONFIG_SERIAL_8250_CONSOLE=y |
| 663 | CONFIG_SERIAL_8250_NR_UARTS=32 | 663 | CONFIG_SERIAL_8250_NR_UARTS=32 |
| 664 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | 664 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 |
| 665 | CONFIG_SERIAL_8250_EXTENDED=y | 665 | CONFIG_SERIAL_8250_EXTENDED=y |
| 666 | CONFIG_SERIAL_8250_MANY_PORTS=y | 666 | CONFIG_SERIAL_8250_MANY_PORTS=y |
| 667 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 667 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/arm/configs/omap_zoom3_defconfig b/arch/arm/configs/omap_zoom3_defconfig index ea9a5012d332..5e55b550a408 100644 --- a/arch/arm/configs/omap_zoom3_defconfig +++ b/arch/arm/configs/omap_zoom3_defconfig | |||
| @@ -680,7 +680,7 @@ CONFIG_DEVKMEM=y | |||
| 680 | CONFIG_SERIAL_8250=y | 680 | CONFIG_SERIAL_8250=y |
| 681 | CONFIG_SERIAL_8250_CONSOLE=y | 681 | CONFIG_SERIAL_8250_CONSOLE=y |
| 682 | CONFIG_SERIAL_8250_NR_UARTS=32 | 682 | CONFIG_SERIAL_8250_NR_UARTS=32 |
| 683 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | 683 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 |
| 684 | CONFIG_SERIAL_8250_EXTENDED=y | 684 | CONFIG_SERIAL_8250_EXTENDED=y |
| 685 | CONFIG_SERIAL_8250_MANY_PORTS=y | 685 | CONFIG_SERIAL_8250_MANY_PORTS=y |
| 686 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 686 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index 45135ffadc57..473f9e13f08b 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig | |||
| @@ -59,8 +59,6 @@ CONFIG_FAIR_GROUP_SCHED=y | |||
| 59 | CONFIG_USER_SCHED=y | 59 | CONFIG_USER_SCHED=y |
| 60 | # CONFIG_CGROUP_SCHED is not set | 60 | # CONFIG_CGROUP_SCHED is not set |
| 61 | # CONFIG_CGROUPS is not set | 61 | # CONFIG_CGROUPS is not set |
| 62 | CONFIG_SYSFS_DEPRECATED=y | ||
| 63 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
| 64 | # CONFIG_RELAY is not set | 62 | # CONFIG_RELAY is not set |
| 65 | # CONFIG_NAMESPACES is not set | 63 | # CONFIG_NAMESPACES is not set |
| 66 | CONFIG_BLK_DEV_INITRD=y | 64 | CONFIG_BLK_DEV_INITRD=y |
| @@ -480,7 +478,6 @@ CONFIG_BT_HIDP=m | |||
| 480 | # CONFIG_BT_HCIBFUSB is not set | 478 | # CONFIG_BT_HCIBFUSB is not set |
| 481 | # CONFIG_BT_HCIVHCI is not set | 479 | # CONFIG_BT_HCIVHCI is not set |
| 482 | # CONFIG_AF_RXRPC is not set | 480 | # CONFIG_AF_RXRPC is not set |
| 483 | # CONFIG_PHONET is not set | ||
| 484 | CONFIG_WIRELESS=y | 481 | CONFIG_WIRELESS=y |
| 485 | CONFIG_CFG80211=y | 482 | CONFIG_CFG80211=y |
| 486 | # CONFIG_CFG80211_REG_DEBUG is not set | 483 | # CONFIG_CFG80211_REG_DEBUG is not set |
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index 9ad118563f7d..20cfbcc6c60c 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c | |||
| @@ -68,12 +68,6 @@ struct sys_timer omap_timer; | |||
| 68 | * --------------------------------------------------------------------------- | 68 | * --------------------------------------------------------------------------- |
| 69 | */ | 69 | */ |
| 70 | 70 | ||
| 71 | #if defined(CONFIG_ARCH_OMAP16XX) | ||
| 72 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 | ||
| 73 | #else | ||
| 74 | #error OMAP 32KHz timer does not currently work on 15XX! | ||
| 75 | #endif | ||
| 76 | |||
| 77 | /* 16xx specific defines */ | 71 | /* 16xx specific defines */ |
| 78 | #define OMAP1_32K_TIMER_BASE 0xfffb9000 | 72 | #define OMAP1_32K_TIMER_BASE 0xfffb9000 |
| 79 | #define OMAP1_32K_TIMER_CR 0x08 | 73 | #define OMAP1_32K_TIMER_CR 0x08 |
| @@ -150,15 +144,6 @@ static struct clock_event_device clockevent_32k_timer = { | |||
| 150 | .set_mode = omap_32k_timer_set_mode, | 144 | .set_mode = omap_32k_timer_set_mode, |
| 151 | }; | 145 | }; |
| 152 | 146 | ||
| 153 | /* | ||
| 154 | * The 32KHz synchronized timer is an additional timer on 16xx. | ||
| 155 | * It is always running. | ||
| 156 | */ | ||
| 157 | static inline unsigned long omap_32k_sync_timer_read(void) | ||
| 158 | { | ||
| 159 | return omap_readl(TIMER_32K_SYNCHRONIZED); | ||
| 160 | } | ||
| 161 | |||
| 162 | static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id) | 147 | static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id) |
| 163 | { | 148 | { |
| 164 | struct clock_event_device *evt = &clockevent_32k_timer; | 149 | struct clock_event_device *evt = &clockevent_32k_timer; |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index a8a3d1e23e26..2455dcc744a0 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
| @@ -59,8 +59,10 @@ config MACH_OMAP3_BEAGLE | |||
| 59 | select OMAP_PACKAGE_CBB | 59 | select OMAP_PACKAGE_CBB |
| 60 | 60 | ||
| 61 | config MACH_DEVKIT8000 | 61 | config MACH_DEVKIT8000 |
| 62 | bool "DEVKIT8000 board" | 62 | bool "DEVKIT8000 board" |
| 63 | depends on ARCH_OMAP3 | 63 | depends on ARCH_OMAP3 |
| 64 | select OMAP_PACKAGE_CUS | ||
| 65 | select OMAP_MUX | ||
| 64 | 66 | ||
| 65 | config MACH_OMAP_LDP | 67 | config MACH_OMAP_LDP |
| 66 | bool "OMAP3 LDP board" | 68 | bool "OMAP3 LDP board" |
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c index a0a2a113465c..504d2bd222fe 100644 --- a/arch/arm/mach-omap2/board-3630sdp.c +++ b/arch/arm/mach-omap2/board-3630sdp.c | |||
| @@ -96,6 +96,7 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
| 96 | static void __init omap_sdp_init(void) | 96 | static void __init omap_sdp_init(void) |
| 97 | { | 97 | { |
| 98 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); | 98 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); |
| 99 | omap_serial_init(); | ||
| 99 | zoom_peripherals_init(); | 100 | zoom_peripherals_init(); |
| 100 | board_smc91x_init(); | 101 | board_smc91x_init(); |
| 101 | enable_board_wakeup_source(); | 102 | enable_board_wakeup_source(); |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 6ae880585d54..c1c4389fbd8f 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
| @@ -294,9 +294,9 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
| 294 | 294 | ||
| 295 | static void __init am3517_evm_init(void) | 295 | static void __init am3517_evm_init(void) |
| 296 | { | 296 | { |
| 297 | am3517_evm_i2c_init(); | ||
| 298 | |||
| 299 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 297 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
| 298 | |||
| 299 | am3517_evm_i2c_init(); | ||
| 300 | platform_add_devices(am3517_evm_devices, | 300 | platform_add_devices(am3517_evm_devices, |
| 301 | ARRAY_SIZE(am3517_evm_devices)); | 301 | ARRAY_SIZE(am3517_evm_devices)); |
| 302 | 302 | ||
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 5bfc13b3176c..47e3af2166d4 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
| @@ -50,7 +50,6 @@ | |||
| 50 | #include <linux/input/matrix_keypad.h> | 50 | #include <linux/input/matrix_keypad.h> |
| 51 | #include <linux/spi/spi.h> | 51 | #include <linux/spi/spi.h> |
| 52 | #include <linux/spi/ads7846.h> | 52 | #include <linux/spi/ads7846.h> |
| 53 | #include <linux/usb/otg.h> | ||
| 54 | #include <linux/dm9000.h> | 53 | #include <linux/dm9000.h> |
| 55 | #include <linux/interrupt.h> | 54 | #include <linux/interrupt.h> |
| 56 | 55 | ||
| @@ -269,20 +268,6 @@ static int devkit8000_twl_gpio_setup(struct device *dev, | |||
| 269 | devkit8000_vmmc1_supply.dev = mmc[0].dev; | 268 | devkit8000_vmmc1_supply.dev = mmc[0].dev; |
| 270 | devkit8000_vsim_supply.dev = mmc[0].dev; | 269 | devkit8000_vsim_supply.dev = mmc[0].dev; |
| 271 | 270 | ||
| 272 | /* REVISIT: need ehci-omap hooks for external VBUS | ||
| 273 | * power switch and overcurrent detect | ||
| 274 | */ | ||
| 275 | |||
| 276 | gpio_request(gpio + 1, "EHCI_nOC"); | ||
| 277 | gpio_direction_input(gpio + 1); | ||
| 278 | |||
| 279 | /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ | ||
| 280 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); | ||
| 281 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); | ||
| 282 | |||
| 283 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | ||
| 284 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
| 285 | |||
| 286 | return 0; | 271 | return 0; |
| 287 | } | 272 | } |
| 288 | 273 | ||
| @@ -303,7 +288,7 @@ static struct regulator_consumer_supply devkit8000_vpll2_supplies[] = { | |||
| 303 | .dev = &devkit8000_lcd_device.dev, | 288 | .dev = &devkit8000_lcd_device.dev, |
| 304 | }, | 289 | }, |
| 305 | { | 290 | { |
| 306 | .supply = "vdss_dsi", | 291 | .supply = "vdds_dsi", |
| 307 | .dev = &devkit8000_dss_device.dev, | 292 | .dev = &devkit8000_dss_device.dev, |
| 308 | } | 293 | } |
| 309 | }; | 294 | }; |
| @@ -639,17 +624,21 @@ static struct omap_musb_board_data musb_board_data = { | |||
| 639 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 624 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 640 | 625 | ||
| 641 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | 626 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 642 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | 627 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 643 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 628 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 644 | 629 | ||
| 645 | .phy_reset = true, | 630 | .phy_reset = true, |
| 646 | .reset_gpio_port[0] = -EINVAL, | 631 | .reset_gpio_port[0] = -EINVAL, |
| 647 | .reset_gpio_port[1] = 147, | 632 | .reset_gpio_port[1] = -EINVAL, |
| 648 | .reset_gpio_port[2] = -EINVAL | 633 | .reset_gpio_port[2] = -EINVAL |
| 649 | }; | 634 | }; |
| 650 | 635 | ||
| 651 | static void __init devkit8000_init(void) | 636 | static void __init devkit8000_init(void) |
| 652 | { | 637 | { |
| 638 | omap_serial_init(); | ||
| 639 | |||
| 640 | omap_dm9000_init(); | ||
| 641 | |||
| 653 | devkit8000_i2c_init(); | 642 | devkit8000_i2c_init(); |
| 654 | platform_add_devices(devkit8000_devices, | 643 | platform_add_devices(devkit8000_devices, |
| 655 | ARRAY_SIZE(devkit8000_devices)); | 644 | ARRAY_SIZE(devkit8000_devices)); |
| @@ -659,25 +648,15 @@ static void __init devkit8000_init(void) | |||
| 659 | spi_register_board_info(devkit8000_spi_board_info, | 648 | spi_register_board_info(devkit8000_spi_board_info, |
| 660 | ARRAY_SIZE(devkit8000_spi_board_info)); | 649 | ARRAY_SIZE(devkit8000_spi_board_info)); |
| 661 | 650 | ||
| 662 | omap_serial_init(); | ||
| 663 | |||
| 664 | omap_dm9000_init(); | ||
| 665 | |||
| 666 | devkit8000_ads7846_init(); | 651 | devkit8000_ads7846_init(); |
| 667 | 652 | ||
| 668 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); | ||
| 669 | |||
| 670 | gpio_request(170, "DVI_nPD"); | ||
| 671 | /* REVISIT leave DVI powered down until it's needed ... */ | ||
| 672 | gpio_direction_output(170, true); | ||
| 673 | |||
| 674 | usb_musb_init(&musb_board_data); | 653 | usb_musb_init(&musb_board_data); |
| 675 | usb_ehci_init(&ehci_pdata); | 654 | usb_ehci_init(&ehci_pdata); |
| 676 | devkit8000_flash_init(); | 655 | devkit8000_flash_init(); |
| 677 | 656 | ||
| 678 | /* Ensure SDRC pins are mux'd for self-refresh */ | 657 | /* Ensure SDRC pins are mux'd for self-refresh */ |
| 679 | omap_mux_init_signal("sdr_cke0", OMAP_PIN_OUTPUT); | 658 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
| 680 | omap_mux_init_signal("sdr_cke1", OMAP_PIN_OUTPUT); | 659 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
| 681 | } | 660 | } |
| 682 | 661 | ||
| 683 | static void __init devkit8000_map_io(void) | 662 | static void __init devkit8000_map_io(void) |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 3c7789d45051..d55c57b761a9 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
| @@ -458,13 +458,13 @@ static struct omap_musb_board_data musb_board_data = { | |||
| 458 | }; | 458 | }; |
| 459 | 459 | ||
| 460 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 460 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 461 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 461 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 462 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | 462 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 463 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 463 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 464 | 464 | ||
| 465 | .phy_reset = true, | 465 | .phy_reset = true, |
| 466 | .reset_gpio_port[0] = -EINVAL, | 466 | .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, |
| 467 | .reset_gpio_port[1] = IGEP2_GPIO_USBH_NRESET, | 467 | .reset_gpio_port[1] = -EINVAL, |
| 468 | .reset_gpio_port[2] = -EINVAL, | 468 | .reset_gpio_port[2] = -EINVAL, |
| 469 | }; | 469 | }; |
| 470 | 470 | ||
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index da9bcb898991..3ccc34ebdcc7 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
| @@ -216,7 +216,7 @@ static void __init n8x0_onenand_init(void) {} | |||
| 216 | */ | 216 | */ |
| 217 | #define N8X0_SLOT_SWITCH_GPIO 96 | 217 | #define N8X0_SLOT_SWITCH_GPIO 96 |
| 218 | #define N810_EMMC_VSD_GPIO 23 | 218 | #define N810_EMMC_VSD_GPIO 23 |
| 219 | #define NN810_EMMC_VIO_GPIO 9 | 219 | #define N810_EMMC_VIO_GPIO 9 |
| 220 | 220 | ||
| 221 | static int n8x0_mmc_switch_slot(struct device *dev, int slot) | 221 | static int n8x0_mmc_switch_slot(struct device *dev, int slot) |
| 222 | { | 222 | { |
| @@ -304,10 +304,10 @@ static void n810_set_power_emmc(struct device *dev, | |||
| 304 | if (power_on) { | 304 | if (power_on) { |
| 305 | gpio_set_value(N810_EMMC_VSD_GPIO, 1); | 305 | gpio_set_value(N810_EMMC_VSD_GPIO, 1); |
| 306 | msleep(1); | 306 | msleep(1); |
| 307 | gpio_set_value(NN810_EMMC_VIO_GPIO, 1); | 307 | gpio_set_value(N810_EMMC_VIO_GPIO, 1); |
| 308 | msleep(1); | 308 | msleep(1); |
| 309 | } else { | 309 | } else { |
| 310 | gpio_set_value(NN810_EMMC_VIO_GPIO, 0); | 310 | gpio_set_value(N810_EMMC_VIO_GPIO, 0); |
| 311 | msleep(50); | 311 | msleep(50); |
| 312 | gpio_set_value(N810_EMMC_VSD_GPIO, 0); | 312 | gpio_set_value(N810_EMMC_VSD_GPIO, 0); |
| 313 | msleep(50); | 313 | msleep(50); |
| @@ -468,7 +468,7 @@ static void n8x0_mmc_cleanup(struct device *dev) | |||
| 468 | 468 | ||
| 469 | if (machine_is_nokia_n810()) { | 469 | if (machine_is_nokia_n810()) { |
| 470 | gpio_free(N810_EMMC_VSD_GPIO); | 470 | gpio_free(N810_EMMC_VSD_GPIO); |
| 471 | gpio_free(NN810_EMMC_VIO_GPIO); | 471 | gpio_free(N810_EMMC_VIO_GPIO); |
| 472 | } | 472 | } |
| 473 | } | 473 | } |
| 474 | 474 | ||
| @@ -529,7 +529,7 @@ void __init n8x0_mmc_init(void) | |||
| 529 | 529 | ||
| 530 | err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); | 530 | err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); |
| 531 | if (err) | 531 | if (err) |
| 532 | return err; | 532 | return; |
| 533 | 533 | ||
| 534 | gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0); | 534 | gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0); |
| 535 | 535 | ||
| @@ -537,17 +537,17 @@ void __init n8x0_mmc_init(void) | |||
| 537 | err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); | 537 | err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); |
| 538 | if (err) { | 538 | if (err) { |
| 539 | gpio_free(N8X0_SLOT_SWITCH_GPIO); | 539 | gpio_free(N8X0_SLOT_SWITCH_GPIO); |
| 540 | return err; | 540 | return; |
| 541 | } | 541 | } |
| 542 | gpio_direction_output(N810_EMMC_VSD_GPIO, 0); | 542 | gpio_direction_output(N810_EMMC_VSD_GPIO, 0); |
| 543 | 543 | ||
| 544 | err = gpio_request(NN810_EMMC_VIO_GPIO, "MMC slot 2 Vdd"); | 544 | err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd"); |
| 545 | if (err) { | 545 | if (err) { |
| 546 | gpio_free(N8X0_SLOT_SWITCH_GPIO); | 546 | gpio_free(N8X0_SLOT_SWITCH_GPIO); |
| 547 | gpio_free(N810_EMMC_VSD_GPIO); | 547 | gpio_free(N810_EMMC_VSD_GPIO); |
| 548 | return err; | 548 | return; |
| 549 | } | 549 | } |
| 550 | gpio_direction_output(NN810_EMMC_VIO_GPIO, 0); | 550 | gpio_direction_output(N810_EMMC_VIO_GPIO, 0); |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | mmc_data[0] = &mmc1_data; | 553 | mmc_data[0] = &mmc1_data; |
diff --git a/arch/arm/mach-omap2/board-sdp-flash.c b/arch/arm/mach-omap2/board-sdp-flash.c index b1b88deec7f2..2d026328e385 100644 --- a/arch/arm/mach-omap2/board-sdp-flash.c +++ b/arch/arm/mach-omap2/board-sdp-flash.c | |||
| @@ -253,20 +253,20 @@ void __init sdp_flash_init(struct flash_partitions sdp_partition_info[]) | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | if (norcs > GPMC_CS_NUM) | 255 | if (norcs > GPMC_CS_NUM) |
| 256 | printk(KERN_INFO "OneNAND: Unable to find configuration " | 256 | printk(KERN_INFO "NOR: Unable to find configuration " |
| 257 | " in GPMC\n "); | 257 | "in GPMC\n"); |
| 258 | else | 258 | else |
| 259 | board_nor_init(sdp_partition_info[0], norcs); | 259 | board_nor_init(sdp_partition_info[0], norcs); |
| 260 | 260 | ||
| 261 | if (onenandcs > GPMC_CS_NUM) | 261 | if (onenandcs > GPMC_CS_NUM) |
| 262 | printk(KERN_INFO "OneNAND: Unable to find configuration " | 262 | printk(KERN_INFO "OneNAND: Unable to find configuration " |
| 263 | " in GPMC\n "); | 263 | "in GPMC\n"); |
| 264 | else | 264 | else |
| 265 | board_onenand_init(sdp_partition_info[1], onenandcs); | 265 | board_onenand_init(sdp_partition_info[1], onenandcs); |
| 266 | 266 | ||
| 267 | if (nandcs > GPMC_CS_NUM) | 267 | if (nandcs > GPMC_CS_NUM) |
| 268 | printk(KERN_INFO "NAND: Unable to find configuration " | 268 | printk(KERN_INFO "NAND: Unable to find configuration " |
| 269 | " in GPMC\n "); | 269 | "in GPMC\n"); |
| 270 | else | 270 | else |
| 271 | board_nand_init(sdp_partition_info[2], nandcs); | 271 | board_nand_init(sdp_partition_info[2], nandcs); |
| 272 | } | 272 | } |
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c index bb4018b60642..e15d2e87cfc1 100644 --- a/arch/arm/mach-omap2/board-zoom-debugboard.c +++ b/arch/arm/mach-omap2/board-zoom-debugboard.c | |||
| @@ -96,7 +96,7 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
| 96 | 96 | ||
| 97 | static struct platform_device zoom_debugboard_serial_device = { | 97 | static struct platform_device zoom_debugboard_serial_device = { |
| 98 | .name = "serial8250", | 98 | .name = "serial8250", |
| 99 | .id = 3, | 99 | .id = PLAT8250_DEV_PLATFORM, |
| 100 | .dev = { | 100 | .dev = { |
| 101 | .platform_data = serial_platform_data, | 101 | .platform_data = serial_platform_data, |
| 102 | }, | 102 | }, |
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index ca95d8d64136..6b3984964cc5 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
| @@ -280,7 +280,6 @@ static void enable_board_wakeup_source(void) | |||
| 280 | void __init zoom_peripherals_init(void) | 280 | void __init zoom_peripherals_init(void) |
| 281 | { | 281 | { |
| 282 | omap_i2c_init(); | 282 | omap_i2c_init(); |
| 283 | omap_serial_init(); | ||
| 284 | usb_musb_init(&musb_board_data); | 283 | usb_musb_init(&musb_board_data); |
| 285 | enable_board_wakeup_source(); | 284 | enable_board_wakeup_source(); |
| 286 | } | 285 | } |
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index d5153b6bd6cb..9cba5560519b 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
| @@ -895,7 +895,7 @@ static struct clk dpll4_m4x2_ck = { | |||
| 895 | .ops = &clkops_omap2_dflt_wait, | 895 | .ops = &clkops_omap2_dflt_wait, |
| 896 | .parent = &dpll4_m4_ck, | 896 | .parent = &dpll4_m4_ck, |
| 897 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | 897 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), |
| 898 | .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, | 898 | .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT, |
| 899 | .flags = INVERT_ENABLE, | 899 | .flags = INVERT_ENABLE, |
| 900 | .clkdm_name = "dpll4_clkdm", | 900 | .clkdm_name = "dpll4_clkdm", |
| 901 | .recalc = &omap3_clkoutx2_recalc, | 901 | .recalc = &omap3_clkoutx2_recalc, |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 28b107967c86..a5c0c9c8e496 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
| @@ -2671,10 +2671,10 @@ static struct omap_clk omap44xx_clks[] = { | |||
| 2671 | CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X), | 2671 | CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X), |
| 2672 | CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X), | 2672 | CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X), |
| 2673 | CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X), | 2673 | CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X), |
| 2674 | CLK("omap-mcspi.1", "ick", &dummy_ck, CK_443X), | 2674 | CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X), |
| 2675 | CLK("omap-mcspi.2", "ick", &dummy_ck, CK_443X), | 2675 | CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X), |
| 2676 | CLK("omap-mcspi.3", "ick", &dummy_ck, CK_443X), | 2676 | CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X), |
| 2677 | CLK("omap-mcspi.4", "ick", &dummy_ck, CK_443X), | 2677 | CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X), |
| 2678 | CLK(NULL, "uart1_ick", &dummy_ck, CK_443X), | 2678 | CLK(NULL, "uart1_ick", &dummy_ck, CK_443X), |
| 2679 | CLK(NULL, "uart2_ick", &dummy_ck, CK_443X), | 2679 | CLK(NULL, "uart2_ick", &dummy_ck, CK_443X), |
| 2680 | CLK(NULL, "uart3_ick", &dummy_ck, CK_443X), | 2680 | CLK(NULL, "uart3_ick", &dummy_ck, CK_443X), |
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index b87ad66f083e..6e568ec995ee 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
| @@ -240,7 +240,7 @@ static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable) | |||
| 240 | bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; | 240 | bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; |
| 241 | else | 241 | else |
| 242 | bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; | 242 | bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; |
| 243 | } else if (cpu_is_omap34xx() | cpu_is_omap44xx()) { | 243 | } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { |
| 244 | if (enable) | 244 | if (enable) |
| 245 | bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; | 245 | bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; |
| 246 | else | 246 | else |
| @@ -812,7 +812,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm) | |||
| 812 | cm_set_mod_reg_bits(OMAP24XX_FORCESTATE, | 812 | cm_set_mod_reg_bits(OMAP24XX_FORCESTATE, |
| 813 | clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL); | 813 | clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL); |
| 814 | 814 | ||
| 815 | } else if (cpu_is_omap34xx() | cpu_is_omap44xx()) { | 815 | } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { |
| 816 | 816 | ||
| 817 | u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP << | 817 | u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP << |
| 818 | __ffs(clkdm->clktrctrl_mask)); | 818 | __ffs(clkdm->clktrctrl_mask)); |
| @@ -856,7 +856,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) | |||
| 856 | cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE, | 856 | cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE, |
| 857 | clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL); | 857 | clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL); |
| 858 | 858 | ||
| 859 | } else if (cpu_is_omap34xx() | cpu_is_omap44xx()) { | 859 | } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { |
| 860 | 860 | ||
| 861 | u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP << | 861 | u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP << |
| 862 | __ffs(clkdm->clktrctrl_mask)); | 862 | __ffs(clkdm->clktrctrl_mask)); |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 23e4d7733610..2271b9bd1f50 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
| @@ -726,7 +726,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
| 726 | if (!cpu_is_omap44xx()) | 726 | if (!cpu_is_omap44xx()) |
| 727 | return; | 727 | return; |
| 728 | base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; | 728 | base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; |
| 729 | irq = OMAP44XX_IRQ_MMC4; | 729 | irq = OMAP44XX_IRQ_MMC5; |
| 730 | break; | 730 | break; |
| 731 | default: | 731 | default: |
| 732 | continue; | 732 | continue; |
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index 64d74f05abbe..e57fb29ff855 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c | |||
| @@ -39,6 +39,9 @@ static int omap2_nand_gpmc_retime(void) | |||
| 39 | struct gpmc_timings t; | 39 | struct gpmc_timings t; |
| 40 | int err; | 40 | int err; |
| 41 | 41 | ||
| 42 | if (!gpmc_nand_data->gpmc_t) | ||
| 43 | return 0; | ||
| 44 | |||
| 42 | memset(&t, 0, sizeof(t)); | 45 | memset(&t, 0, sizeof(t)); |
| 43 | t.sync_clk = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->sync_clk); | 46 | t.sync_clk = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->sync_clk); |
| 44 | t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on); | 47 | t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on); |
diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S index ff25c7e4e606..50fd74916643 100644 --- a/arch/arm/mach-omap2/include/mach/entry-macro.S +++ b/arch/arm/mach-omap2/include/mach/entry-macro.S | |||
| @@ -52,7 +52,7 @@ omap_irq_base: .word 0 | |||
| 52 | 52 | ||
| 53 | mrc p15, 0, \tmp, c0, c0, 0 @ get processor revision | 53 | mrc p15, 0, \tmp, c0, c0, 0 @ get processor revision |
| 54 | and \tmp, \tmp, #0x000f0000 @ only check architecture | 54 | and \tmp, \tmp, #0x000f0000 @ only check architecture |
| 55 | cmp \tmp, #0x00060000 @ is v6? | 55 | cmp \tmp, #0x00070000 @ is v6? |
| 56 | beq 2400f @ found v6 so it's omap24xx | 56 | beq 2400f @ found v6 so it's omap24xx |
| 57 | mrc p15, 0, \tmp, c0, c0, 0 @ get processor revision | 57 | mrc p15, 0, \tmp, c0, c0, 0 @ get processor revision |
| 58 | and \tmp, \tmp, #0x000000f0 @ check cortex 8 or 9 | 58 | and \tmp, \tmp, #0x000000f0 @ check cortex 8 or 9 |
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S index aa3f65c2ac97..ef0e7a00dd6c 100644 --- a/arch/arm/mach-omap2/omap-headsmp.S +++ b/arch/arm/mach-omap2/omap-headsmp.S | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | ENTRY(omap_secondary_startup) | 33 | ENTRY(omap_secondary_startup) |
| 34 | hold: ldr r12,=0x103 | 34 | hold: ldr r12,=0x103 |
| 35 | dsb | 35 | dsb |
| 36 | smc @ read from AuxCoreBoot0 | 36 | smc #0 @ read from AuxCoreBoot0 |
| 37 | mov r0, r0, lsr #9 | 37 | mov r0, r0, lsr #9 |
| 38 | mrc p15, 0, r4, c0, c0, 5 | 38 | mrc p15, 0, r4, c0, c0, 5 |
| 39 | and r4, r4, #0x0f | 39 | and r4, r4, #0x0f |
| @@ -52,7 +52,7 @@ ENTRY(omap_modify_auxcoreboot0) | |||
| 52 | stmfd sp!, {r1-r12, lr} | 52 | stmfd sp!, {r1-r12, lr} |
| 53 | ldr r12, =0x104 | 53 | ldr r12, =0x104 |
| 54 | dsb | 54 | dsb |
| 55 | smc | 55 | smc #0 |
| 56 | ldmfd sp!, {r1-r12, pc} | 56 | ldmfd sp!, {r1-r12, pc} |
| 57 | END(omap_modify_auxcoreboot0) | 57 | END(omap_modify_auxcoreboot0) |
| 58 | 58 | ||
| @@ -60,6 +60,6 @@ ENTRY(omap_auxcoreboot_addr) | |||
| 60 | stmfd sp!, {r2-r12, lr} | 60 | stmfd sp!, {r2-r12, lr} |
| 61 | ldr r12, =0x105 | 61 | ldr r12, =0x105 |
| 62 | dsb | 62 | dsb |
| 63 | smc | 63 | smc #0 |
| 64 | ldmfd sp!, {r2-r12, pc} | 64 | ldmfd sp!, {r2-r12, pc} |
| 65 | END(omap_auxcoreboot_addr) | 65 | END(omap_auxcoreboot_addr) |
diff --git a/arch/arm/mach-omap2/omap44xx-smc.S b/arch/arm/mach-omap2/omap44xx-smc.S index 89bb2b141473..f61c7771ca47 100644 --- a/arch/arm/mach-omap2/omap44xx-smc.S +++ b/arch/arm/mach-omap2/omap44xx-smc.S | |||
| @@ -27,6 +27,6 @@ ENTRY(omap_smc1) | |||
| 27 | mov r12, r0 | 27 | mov r12, r0 |
| 28 | mov r0, r1 | 28 | mov r0, r1 |
| 29 | dsb | 29 | dsb |
| 30 | smc | 30 | smc #0 |
| 31 | ldmfd sp!, {r2-r12, pc} | 31 | ldmfd sp!, {r2-r12, pc} |
| 32 | END(omap_smc1) | 32 | END(omap_smc1) |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index c6649472ce0d..e436dcb19795 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
| @@ -1511,6 +1511,9 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) | |||
| 1511 | c = oh->slaves[oh->_mpu_port_index]->_clk; | 1511 | c = oh->slaves[oh->_mpu_port_index]->_clk; |
| 1512 | } | 1512 | } |
| 1513 | 1513 | ||
| 1514 | if (!c->clkdm) | ||
| 1515 | return NULL; | ||
| 1516 | |||
| 1514 | return c->clkdm->pwrdm.ptr; | 1517 | return c->clkdm->pwrdm.ptr; |
| 1515 | 1518 | ||
| 1516 | } | 1519 | } |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 9a0fb385622b..ebfce7d1a5d3 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
| @@ -222,7 +222,7 @@ void pwrdm_init(struct powerdomain **pwrdm_list) | |||
| 222 | { | 222 | { |
| 223 | struct powerdomain **p = NULL; | 223 | struct powerdomain **p = NULL; |
| 224 | 224 | ||
| 225 | if (cpu_is_omap24xx() | cpu_is_omap34xx()) { | 225 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { |
| 226 | pwrstctrl_reg_offs = OMAP2_PM_PWSTCTRL; | 226 | pwrstctrl_reg_offs = OMAP2_PM_PWSTCTRL; |
| 227 | pwrstst_reg_offs = OMAP2_PM_PWSTST; | 227 | pwrstst_reg_offs = OMAP2_PM_PWSTST; |
| 228 | } else if (cpu_is_omap44xx()) { | 228 | } else if (cpu_is_omap44xx()) { |
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index 9537f6f2352d..07a60f1204ca 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c | |||
| @@ -123,7 +123,7 @@ struct omap3_prcm_regs prcm_context; | |||
| 123 | u32 omap_prcm_get_reset_sources(void) | 123 | u32 omap_prcm_get_reset_sources(void) |
| 124 | { | 124 | { |
| 125 | /* XXX This presumably needs modification for 34XX */ | 125 | /* XXX This presumably needs modification for 34XX */ |
| 126 | if (cpu_is_omap24xx() | cpu_is_omap34xx()) | 126 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) |
| 127 | return prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f; | 127 | return prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f; |
| 128 | if (cpu_is_omap44xx()) | 128 | if (cpu_is_omap44xx()) |
| 129 | return prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f; | 129 | return prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f; |
| @@ -157,7 +157,7 @@ void omap_prcm_arch_reset(char mode, const char *cmd) | |||
| 157 | else | 157 | else |
| 158 | WARN_ON(1); | 158 | WARN_ON(1); |
| 159 | 159 | ||
| 160 | if (cpu_is_omap24xx() | cpu_is_omap34xx()) | 160 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) |
| 161 | prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, | 161 | prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, |
| 162 | OMAP2_RM_RSTCTRL); | 162 | OMAP2_RM_RSTCTRL); |
| 163 | if (cpu_is_omap44xx()) | 163 | if (cpu_is_omap44xx()) |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index da77930480e9..3771254dfa81 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
| @@ -115,7 +115,6 @@ static struct plat_serial8250_port serial_platform_data2[] = { | |||
| 115 | } | 115 | } |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) | ||
| 119 | static struct plat_serial8250_port serial_platform_data3[] = { | 118 | static struct plat_serial8250_port serial_platform_data3[] = { |
| 120 | { | 119 | { |
| 121 | .irq = 70, | 120 | .irq = 70, |
| @@ -128,23 +127,12 @@ static struct plat_serial8250_port serial_platform_data3[] = { | |||
| 128 | } | 127 | } |
| 129 | }; | 128 | }; |
| 130 | 129 | ||
| 131 | static inline void omap2_set_globals_uart4(struct omap_globals *omap2_globals) | ||
| 132 | { | ||
| 133 | serial_platform_data3[0].mapbase = omap2_globals->uart4_phys; | ||
| 134 | } | ||
| 135 | #else | ||
| 136 | static inline void omap2_set_globals_uart4(struct omap_globals *omap2_globals) | ||
| 137 | { | ||
| 138 | } | ||
| 139 | #endif | ||
| 140 | |||
| 141 | void __init omap2_set_globals_uart(struct omap_globals *omap2_globals) | 130 | void __init omap2_set_globals_uart(struct omap_globals *omap2_globals) |
| 142 | { | 131 | { |
| 143 | serial_platform_data0[0].mapbase = omap2_globals->uart1_phys; | 132 | serial_platform_data0[0].mapbase = omap2_globals->uart1_phys; |
| 144 | serial_platform_data1[0].mapbase = omap2_globals->uart2_phys; | 133 | serial_platform_data1[0].mapbase = omap2_globals->uart2_phys; |
| 145 | serial_platform_data2[0].mapbase = omap2_globals->uart3_phys; | 134 | serial_platform_data2[0].mapbase = omap2_globals->uart3_phys; |
| 146 | if (cpu_is_omap3630() || cpu_is_omap44xx()) | 135 | serial_platform_data3[0].mapbase = omap2_globals->uart4_phys; |
| 147 | omap2_set_globals_uart4(omap2_globals); | ||
| 148 | } | 136 | } |
| 149 | 137 | ||
| 150 | static inline unsigned int __serial_read_reg(struct uart_port *up, | 138 | static inline unsigned int __serial_read_reg(struct uart_port *up, |
| @@ -550,7 +538,7 @@ static ssize_t sleep_timeout_store(struct device *dev, | |||
| 550 | unsigned int value; | 538 | unsigned int value; |
| 551 | 539 | ||
| 552 | if (sscanf(buf, "%u", &value) != 1) { | 540 | if (sscanf(buf, "%u", &value) != 1) { |
| 553 | printk(KERN_ERR "sleep_timeout_store: Invalid value\n"); | 541 | dev_err(dev, "sleep_timeout_store: Invalid value\n"); |
| 554 | return -EINVAL; | 542 | return -EINVAL; |
| 555 | } | 543 | } |
| 556 | 544 | ||
| @@ -664,27 +652,33 @@ void __init omap_serial_early_init(void) | |||
| 664 | struct device *dev = &pdev->dev; | 652 | struct device *dev = &pdev->dev; |
| 665 | struct plat_serial8250_port *p = dev->platform_data; | 653 | struct plat_serial8250_port *p = dev->platform_data; |
| 666 | 654 | ||
| 655 | /* Don't map zero-based physical address */ | ||
| 656 | if (p->mapbase == 0) { | ||
| 657 | dev_warn(dev, "no physical address for uart#%d," | ||
| 658 | " so skipping early_init...\n", i); | ||
| 659 | continue; | ||
| 660 | } | ||
| 667 | /* | 661 | /* |
| 668 | * Module 4KB + L4 interconnect 4KB | 662 | * Module 4KB + L4 interconnect 4KB |
| 669 | * Static mapping, never released | 663 | * Static mapping, never released |
| 670 | */ | 664 | */ |
| 671 | p->membase = ioremap(p->mapbase, SZ_8K); | 665 | p->membase = ioremap(p->mapbase, SZ_8K); |
| 672 | if (!p->membase) { | 666 | if (!p->membase) { |
| 673 | printk(KERN_ERR "ioremap failed for uart%i\n", i + 1); | 667 | dev_err(dev, "ioremap failed for uart%i\n", i + 1); |
| 674 | continue; | 668 | continue; |
| 675 | } | 669 | } |
| 676 | 670 | ||
| 677 | sprintf(name, "uart%d_ick", i + 1); | 671 | sprintf(name, "uart%d_ick", i + 1); |
| 678 | uart->ick = clk_get(NULL, name); | 672 | uart->ick = clk_get(NULL, name); |
| 679 | if (IS_ERR(uart->ick)) { | 673 | if (IS_ERR(uart->ick)) { |
| 680 | printk(KERN_ERR "Could not get uart%d_ick\n", i + 1); | 674 | dev_err(dev, "Could not get uart%d_ick\n", i + 1); |
| 681 | uart->ick = NULL; | 675 | uart->ick = NULL; |
| 682 | } | 676 | } |
| 683 | 677 | ||
| 684 | sprintf(name, "uart%d_fck", i+1); | 678 | sprintf(name, "uart%d_fck", i+1); |
| 685 | uart->fck = clk_get(NULL, name); | 679 | uart->fck = clk_get(NULL, name); |
| 686 | if (IS_ERR(uart->fck)) { | 680 | if (IS_ERR(uart->fck)) { |
| 687 | printk(KERN_ERR "Could not get uart%d_fck\n", i + 1); | 681 | dev_err(dev, "Could not get uart%d_fck\n", i + 1); |
| 688 | uart->fck = NULL; | 682 | uart->fck = NULL; |
| 689 | } | 683 | } |
| 690 | 684 | ||
| @@ -727,6 +721,13 @@ void __init omap_serial_init_port(int port) | |||
| 727 | pdev = &uart->pdev; | 721 | pdev = &uart->pdev; |
| 728 | dev = &pdev->dev; | 722 | dev = &pdev->dev; |
| 729 | 723 | ||
| 724 | /* Don't proceed if there's no clocks available */ | ||
| 725 | if (unlikely(!uart->ick || !uart->fck)) { | ||
| 726 | WARN(1, "%s: can't init uart%d, no clocks available\n", | ||
| 727 | kobject_name(&dev->kobj), port); | ||
| 728 | return; | ||
| 729 | } | ||
| 730 | |||
| 730 | omap_uart_enable_clocks(uart); | 731 | omap_uart_enable_clocks(uart); |
| 731 | 732 | ||
| 732 | omap_uart_reset(uart); | 733 | omap_uart_reset(uart); |
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 088c1a03b946..f12f0e39ddf2 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
| @@ -44,9 +44,6 @@ | |||
| 44 | 44 | ||
| 45 | #define NO_LENGTH_CHECK 0xffffffff | 45 | #define NO_LENGTH_CHECK 0xffffffff |
| 46 | 46 | ||
| 47 | unsigned char omap_bootloader_tag[512]; | ||
| 48 | int omap_bootloader_tag_len; | ||
| 49 | |||
| 50 | struct omap_board_config_kernel *omap_board_config; | 47 | struct omap_board_config_kernel *omap_board_config; |
| 51 | int omap_board_config_size; | 48 | int omap_board_config_size; |
| 52 | 49 | ||
| @@ -100,10 +97,17 @@ EXPORT_SYMBOL(omap_get_var_config); | |||
| 100 | 97 | ||
| 101 | #include <linux/clocksource.h> | 98 | #include <linux/clocksource.h> |
| 102 | 99 | ||
| 100 | /* | ||
| 101 | * offset_32k holds the init time counter value. It is then subtracted | ||
| 102 | * from every counter read to achieve a counter that counts time from the | ||
| 103 | * kernel boot (needed for sched_clock()). | ||
| 104 | */ | ||
| 105 | static u32 offset_32k __read_mostly; | ||
| 106 | |||
| 103 | #ifdef CONFIG_ARCH_OMAP16XX | 107 | #ifdef CONFIG_ARCH_OMAP16XX |
| 104 | static cycle_t omap16xx_32k_read(struct clocksource *cs) | 108 | static cycle_t omap16xx_32k_read(struct clocksource *cs) |
| 105 | { | 109 | { |
| 106 | return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED); | 110 | return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k; |
| 107 | } | 111 | } |
| 108 | #else | 112 | #else |
| 109 | #define omap16xx_32k_read NULL | 113 | #define omap16xx_32k_read NULL |
| @@ -112,7 +116,7 @@ static cycle_t omap16xx_32k_read(struct clocksource *cs) | |||
| 112 | #ifdef CONFIG_ARCH_OMAP2420 | 116 | #ifdef CONFIG_ARCH_OMAP2420 |
| 113 | static cycle_t omap2420_32k_read(struct clocksource *cs) | 117 | static cycle_t omap2420_32k_read(struct clocksource *cs) |
| 114 | { | 118 | { |
| 115 | return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10); | 119 | return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k; |
| 116 | } | 120 | } |
| 117 | #else | 121 | #else |
| 118 | #define omap2420_32k_read NULL | 122 | #define omap2420_32k_read NULL |
| @@ -121,7 +125,7 @@ static cycle_t omap2420_32k_read(struct clocksource *cs) | |||
| 121 | #ifdef CONFIG_ARCH_OMAP2430 | 125 | #ifdef CONFIG_ARCH_OMAP2430 |
| 122 | static cycle_t omap2430_32k_read(struct clocksource *cs) | 126 | static cycle_t omap2430_32k_read(struct clocksource *cs) |
| 123 | { | 127 | { |
| 124 | return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10); | 128 | return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k; |
| 125 | } | 129 | } |
| 126 | #else | 130 | #else |
| 127 | #define omap2430_32k_read NULL | 131 | #define omap2430_32k_read NULL |
| @@ -130,7 +134,7 @@ static cycle_t omap2430_32k_read(struct clocksource *cs) | |||
| 130 | #ifdef CONFIG_ARCH_OMAP3 | 134 | #ifdef CONFIG_ARCH_OMAP3 |
| 131 | static cycle_t omap34xx_32k_read(struct clocksource *cs) | 135 | static cycle_t omap34xx_32k_read(struct clocksource *cs) |
| 132 | { | 136 | { |
| 133 | return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10); | 137 | return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k; |
| 134 | } | 138 | } |
| 135 | #else | 139 | #else |
| 136 | #define omap34xx_32k_read NULL | 140 | #define omap34xx_32k_read NULL |
| @@ -139,7 +143,7 @@ static cycle_t omap34xx_32k_read(struct clocksource *cs) | |||
| 139 | #ifdef CONFIG_ARCH_OMAP4 | 143 | #ifdef CONFIG_ARCH_OMAP4 |
| 140 | static cycle_t omap44xx_32k_read(struct clocksource *cs) | 144 | static cycle_t omap44xx_32k_read(struct clocksource *cs) |
| 141 | { | 145 | { |
| 142 | return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10); | 146 | return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k; |
| 143 | } | 147 | } |
| 144 | #else | 148 | #else |
| 145 | #define omap44xx_32k_read NULL | 149 | #define omap44xx_32k_read NULL |
| @@ -227,6 +231,8 @@ static int __init omap_init_clocksource_32k(void) | |||
| 227 | clocksource_32k.mult = clocksource_hz2mult(32768, | 231 | clocksource_32k.mult = clocksource_hz2mult(32768, |
| 228 | clocksource_32k.shift); | 232 | clocksource_32k.shift); |
| 229 | 233 | ||
| 234 | offset_32k = clocksource_32k.read(&clocksource_32k); | ||
| 235 | |||
| 230 | if (clocksource_register(&clocksource_32k)) | 236 | if (clocksource_register(&clocksource_32k)) |
| 231 | printk(err, clocksource_32k.name); | 237 | printk(err, clocksource_32k.name); |
| 232 | } | 238 | } |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 5c6c342c53f5..1d959965ff52 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
| @@ -937,6 +937,15 @@ void omap_start_dma(int lch) | |||
| 937 | { | 937 | { |
| 938 | u32 l; | 938 | u32 l; |
| 939 | 939 | ||
| 940 | /* | ||
| 941 | * The CPC/CDAC register needs to be initialized to zero | ||
| 942 | * before starting dma transfer. | ||
| 943 | */ | ||
| 944 | if (cpu_is_omap15xx()) | ||
| 945 | dma_write(0, CPC(lch)); | ||
| 946 | else | ||
| 947 | dma_write(0, CDAC(lch)); | ||
| 948 | |||
| 940 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { | 949 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { |
| 941 | int next_lch, cur_lch; | 950 | int next_lch, cur_lch; |
| 942 | char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT]; | 951 | char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT]; |
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 76a347b3ce07..45a225d09125 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
| @@ -798,7 +798,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
| 798 | case METHOD_MPUIO: | 798 | case METHOD_MPUIO: |
| 799 | reg += OMAP_MPUIO_GPIO_INT_EDGE; | 799 | reg += OMAP_MPUIO_GPIO_INT_EDGE; |
| 800 | l = __raw_readl(reg); | 800 | l = __raw_readl(reg); |
| 801 | if (trigger & IRQ_TYPE_EDGE_BOTH) | 801 | if ((trigger & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) |
| 802 | bank->toggle_mask |= 1 << gpio; | 802 | bank->toggle_mask |= 1 << gpio; |
| 803 | if (trigger & IRQ_TYPE_EDGE_RISING) | 803 | if (trigger & IRQ_TYPE_EDGE_RISING) |
| 804 | l |= 1 << gpio; | 804 | l |= 1 << gpio; |
| @@ -812,7 +812,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
| 812 | case METHOD_GPIO_1510: | 812 | case METHOD_GPIO_1510: |
| 813 | reg += OMAP1510_GPIO_INT_CONTROL; | 813 | reg += OMAP1510_GPIO_INT_CONTROL; |
| 814 | l = __raw_readl(reg); | 814 | l = __raw_readl(reg); |
| 815 | if (trigger & IRQ_TYPE_EDGE_BOTH) | 815 | if ((trigger & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) |
| 816 | bank->toggle_mask |= 1 << gpio; | 816 | bank->toggle_mask |= 1 << gpio; |
| 817 | if (trigger & IRQ_TYPE_EDGE_RISING) | 817 | if (trigger & IRQ_TYPE_EDGE_RISING) |
| 818 | l |= 1 << gpio; | 818 | l |= 1 << gpio; |
| @@ -846,7 +846,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
| 846 | case METHOD_GPIO_7XX: | 846 | case METHOD_GPIO_7XX: |
| 847 | reg += OMAP7XX_GPIO_INT_CONTROL; | 847 | reg += OMAP7XX_GPIO_INT_CONTROL; |
| 848 | l = __raw_readl(reg); | 848 | l = __raw_readl(reg); |
| 849 | if (trigger & IRQ_TYPE_EDGE_BOTH) | 849 | if ((trigger & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) |
| 850 | bank->toggle_mask |= 1 << gpio; | 850 | bank->toggle_mask |= 1 << gpio; |
| 851 | if (trigger & IRQ_TYPE_EDGE_RISING) | 851 | if (trigger & IRQ_TYPE_EDGE_RISING) |
| 852 | l |= 1 << gpio; | 852 | l |= 1 << gpio; |
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h index b65088a869e9..401701977dbb 100644 --- a/arch/arm/plat-omap/include/plat/irqs.h +++ b/arch/arm/plat-omap/include/plat/irqs.h | |||
| @@ -345,8 +345,6 @@ | |||
| 345 | #define INT_34XX_MMC3_IRQ 94 | 345 | #define INT_34XX_MMC3_IRQ 94 |
| 346 | #define INT_34XX_GPT12_IRQ 95 | 346 | #define INT_34XX_GPT12_IRQ 95 |
| 347 | 347 | ||
| 348 | #define INT_34XX_BENCH_MPU_EMUL 3 | ||
| 349 | |||
| 350 | #define INT_35XX_HECC0_IRQ 24 | 348 | #define INT_35XX_HECC0_IRQ 24 |
| 351 | #define INT_35XX_HECC1_IRQ 28 | 349 | #define INT_35XX_HECC1_IRQ 28 |
| 352 | #define INT_35XX_EMAC_C0_RXTHRESH_IRQ 67 | 350 | #define INT_35XX_EMAC_C0_RXTHRESH_IRQ 67 |
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h index 39748354ce45..7de903d7c1ce 100644 --- a/arch/arm/plat-omap/include/plat/mcbsp.h +++ b/arch/arm/plat-omap/include/plat/mcbsp.h | |||
| @@ -59,7 +59,7 @@ | |||
| 59 | #define OMAP44XX_MCBSP1_BASE 0x49022000 | 59 | #define OMAP44XX_MCBSP1_BASE 0x49022000 |
| 60 | #define OMAP44XX_MCBSP2_BASE 0x49024000 | 60 | #define OMAP44XX_MCBSP2_BASE 0x49024000 |
| 61 | #define OMAP44XX_MCBSP3_BASE 0x49026000 | 61 | #define OMAP44XX_MCBSP3_BASE 0x49026000 |
| 62 | #define OMAP44XX_MCBSP4_BASE 0x48074000 | 62 | #define OMAP44XX_MCBSP4_BASE 0x48096000 |
| 63 | 63 | ||
| 64 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | 64 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
| 65 | 65 | ||
diff --git a/arch/arm/plat-omap/include/plat/nand.h b/arch/arm/plat-omap/include/plat/nand.h index 6ba88d2630d9..f8efd5466b1d 100644 --- a/arch/arm/plat-omap/include/plat/nand.h +++ b/arch/arm/plat-omap/include/plat/nand.h | |||
| @@ -29,4 +29,11 @@ struct omap_nand_platform_data { | |||
| 29 | /* size (4 KiB) for IO mapping */ | 29 | /* size (4 KiB) for IO mapping */ |
| 30 | #define NAND_IO_SIZE SZ_4K | 30 | #define NAND_IO_SIZE SZ_4K |
| 31 | 31 | ||
| 32 | #if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE) | ||
| 32 | extern int gpmc_nand_init(struct omap_nand_platform_data *d); | 33 | extern int gpmc_nand_init(struct omap_nand_platform_data *d); |
| 34 | #else | ||
| 35 | static inline int gpmc_nand_init(struct omap_nand_platform_data *d) | ||
| 36 | { | ||
| 37 | return 0; | ||
| 38 | } | ||
| 39 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h index 2302474a3748..b3ef1a7f53cc 100644 --- a/arch/arm/plat-omap/include/plat/omap44xx.h +++ b/arch/arm/plat-omap/include/plat/omap44xx.h | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #define OMAP4430_PRM_BASE 0x4a306000 | 32 | #define OMAP4430_PRM_BASE 0x4a306000 |
| 33 | #define OMAP44XX_GPMC_BASE 0x50000000 | 33 | #define OMAP44XX_GPMC_BASE 0x50000000 |
| 34 | #define OMAP443X_SCM_BASE 0x4a002000 | 34 | #define OMAP443X_SCM_BASE 0x4a002000 |
| 35 | #define OMAP443X_CTRL_BASE OMAP443X_SCM_BASE | 35 | #define OMAP443X_CTRL_BASE 0x4a100000 |
| 36 | #define OMAP44XX_IC_BASE 0x48200000 | 36 | #define OMAP44XX_IC_BASE 0x48200000 |
| 37 | #define OMAP44XX_IVA_INTC_BASE 0x40000000 | 37 | #define OMAP44XX_IVA_INTC_BASE 0x40000000 |
| 38 | #define IRQ_SIR_IRQ 0x0040 | 38 | #define IRQ_SIR_IRQ 0x0040 |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 440b4164f2f6..36d6ea56ab51 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
| @@ -294,8 +294,8 @@ struct omap_hwmod_class_sysconfig { | |||
| 294 | u16 rev_offs; | 294 | u16 rev_offs; |
| 295 | u16 sysc_offs; | 295 | u16 sysc_offs; |
| 296 | u16 syss_offs; | 296 | u16 syss_offs; |
| 297 | u16 sysc_flags; | ||
| 297 | u8 idlemodes; | 298 | u8 idlemodes; |
| 298 | u8 sysc_flags; | ||
| 299 | u8 clockact; | 299 | u8 clockact; |
| 300 | struct omap_hwmod_sysc_fields *sysc_fields; | 300 | struct omap_hwmod_sysc_fields *sysc_fields; |
| 301 | }; | 301 | }; |
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c index dd5b882aab40..5e73c25f8f85 100644 --- a/arch/avr32/kernel/ptrace.c +++ b/arch/avr32/kernel/ptrace.c | |||
| @@ -28,7 +28,7 @@ static struct pt_regs *get_user_regs(struct task_struct *tsk) | |||
| 28 | THREAD_SIZE - sizeof(struct pt_regs)); | 28 | THREAD_SIZE - sizeof(struct pt_regs)); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | static void user_enable_single_step(struct task_struct *tsk) | 31 | void user_enable_single_step(struct task_struct *tsk) |
| 32 | { | 32 | { |
| 33 | pr_debug("user_enable_single_step: pid=%u, PC=0x%08lx, SR=0x%08lx\n", | 33 | pr_debug("user_enable_single_step: pid=%u, PC=0x%08lx, SR=0x%08lx\n", |
| 34 | tsk->pid, task_pt_regs(tsk)->pc, task_pt_regs(tsk)->sr); | 34 | tsk->pid, task_pt_regs(tsk)->pc, task_pt_regs(tsk)->sr); |
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 1ba7e0aca878..4f0c06c7a338 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
| @@ -109,6 +109,7 @@ void blk_rq_timed_out_timer(unsigned long data) | |||
| 109 | struct request_queue *q = (struct request_queue *) data; | 109 | struct request_queue *q = (struct request_queue *) data; |
| 110 | unsigned long flags, next = 0; | 110 | unsigned long flags, next = 0; |
| 111 | struct request *rq, *tmp; | 111 | struct request *rq, *tmp; |
| 112 | int next_set = 0; | ||
| 112 | 113 | ||
| 113 | spin_lock_irqsave(q->queue_lock, flags); | 114 | spin_lock_irqsave(q->queue_lock, flags); |
| 114 | 115 | ||
| @@ -122,16 +123,13 @@ void blk_rq_timed_out_timer(unsigned long data) | |||
| 122 | if (blk_mark_rq_complete(rq)) | 123 | if (blk_mark_rq_complete(rq)) |
| 123 | continue; | 124 | continue; |
| 124 | blk_rq_timed_out(rq); | 125 | blk_rq_timed_out(rq); |
| 125 | } else if (!next || time_after(next, rq->deadline)) | 126 | } else if (!next_set || time_after(next, rq->deadline)) { |
| 126 | next = rq->deadline; | 127 | next = rq->deadline; |
| 128 | next_set = 1; | ||
| 129 | } | ||
| 127 | } | 130 | } |
| 128 | 131 | ||
| 129 | /* | 132 | if (next_set) |
| 130 | * next can never be 0 here with the list non-empty, since we always | ||
| 131 | * bump ->deadline to 1 so we can detect if the timer was ever added | ||
| 132 | * or not. See comment in blk_add_timer() | ||
| 133 | */ | ||
| 134 | if (next) | ||
| 135 | mod_timer(&q->timeout, round_jiffies_up(next)); | 133 | mod_timer(&q->timeout, round_jiffies_up(next)); |
| 136 | 134 | ||
| 137 | spin_unlock_irqrestore(q->queue_lock, flags); | 135 | spin_unlock_irqrestore(q->queue_lock, flags); |
diff --git a/crypto/authenc.c b/crypto/authenc.c index 2bb7348d8d55..05eb32e0d949 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
| @@ -46,6 +46,12 @@ struct authenc_request_ctx { | |||
| 46 | char tail[]; | 46 | char tail[]; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | static void authenc_request_complete(struct aead_request *req, int err) | ||
| 50 | { | ||
| 51 | if (err != -EINPROGRESS) | ||
| 52 | aead_request_complete(req, err); | ||
| 53 | } | ||
| 54 | |||
| 49 | static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key, | 55 | static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key, |
| 50 | unsigned int keylen) | 56 | unsigned int keylen) |
| 51 | { | 57 | { |
| @@ -142,7 +148,7 @@ static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq, | |||
| 142 | crypto_aead_authsize(authenc), 1); | 148 | crypto_aead_authsize(authenc), 1); |
| 143 | 149 | ||
| 144 | out: | 150 | out: |
| 145 | aead_request_complete(req, err); | 151 | authenc_request_complete(req, err); |
| 146 | } | 152 | } |
| 147 | 153 | ||
| 148 | static void authenc_geniv_ahash_done(struct crypto_async_request *areq, int err) | 154 | static void authenc_geniv_ahash_done(struct crypto_async_request *areq, int err) |
| @@ -208,7 +214,7 @@ static void authenc_verify_ahash_update_done(struct crypto_async_request *areq, | |||
| 208 | err = crypto_ablkcipher_decrypt(abreq); | 214 | err = crypto_ablkcipher_decrypt(abreq); |
| 209 | 215 | ||
| 210 | out: | 216 | out: |
| 211 | aead_request_complete(req, err); | 217 | authenc_request_complete(req, err); |
| 212 | } | 218 | } |
| 213 | 219 | ||
| 214 | static void authenc_verify_ahash_done(struct crypto_async_request *areq, | 220 | static void authenc_verify_ahash_done(struct crypto_async_request *areq, |
| @@ -245,7 +251,7 @@ static void authenc_verify_ahash_done(struct crypto_async_request *areq, | |||
| 245 | err = crypto_ablkcipher_decrypt(abreq); | 251 | err = crypto_ablkcipher_decrypt(abreq); |
| 246 | 252 | ||
| 247 | out: | 253 | out: |
| 248 | aead_request_complete(req, err); | 254 | authenc_request_complete(req, err); |
| 249 | } | 255 | } |
| 250 | 256 | ||
| 251 | static u8 *crypto_authenc_ahash_fb(struct aead_request *req, unsigned int flags) | 257 | static u8 *crypto_authenc_ahash_fb(struct aead_request *req, unsigned int flags) |
| @@ -379,7 +385,7 @@ static void crypto_authenc_encrypt_done(struct crypto_async_request *req, | |||
| 379 | err = crypto_authenc_genicv(areq, iv, 0); | 385 | err = crypto_authenc_genicv(areq, iv, 0); |
| 380 | } | 386 | } |
| 381 | 387 | ||
| 382 | aead_request_complete(areq, err); | 388 | authenc_request_complete(areq, err); |
| 383 | } | 389 | } |
| 384 | 390 | ||
| 385 | static int crypto_authenc_encrypt(struct aead_request *req) | 391 | static int crypto_authenc_encrypt(struct aead_request *req) |
| @@ -420,7 +426,7 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req, | |||
| 420 | err = crypto_authenc_genicv(areq, greq->giv, 0); | 426 | err = crypto_authenc_genicv(areq, greq->giv, 0); |
| 421 | } | 427 | } |
| 422 | 428 | ||
| 423 | aead_request_complete(areq, err); | 429 | authenc_request_complete(areq, err); |
| 424 | } | 430 | } |
| 425 | 431 | ||
| 426 | static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req) | 432 | static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req) |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 67e0fc542249..93d1f9b469d4 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
| @@ -1695,6 +1695,7 @@ int drbd_send_protocol(struct drbd_conf *mdev) | |||
| 1695 | cf |= CF_DRY_RUN; | 1695 | cf |= CF_DRY_RUN; |
| 1696 | else { | 1696 | else { |
| 1697 | dev_err(DEV, "--dry-run is not supported by peer"); | 1697 | dev_err(DEV, "--dry-run is not supported by peer"); |
| 1698 | kfree(p); | ||
| 1698 | return 0; | 1699 | return 0; |
| 1699 | } | 1700 | } |
| 1700 | } | 1701 | } |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index ed9f1de24a71..3f096e7959b4 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
| @@ -899,7 +899,8 @@ retry: | |||
| 899 | 899 | ||
| 900 | drbd_thread_start(&mdev->asender); | 900 | drbd_thread_start(&mdev->asender); |
| 901 | 901 | ||
| 902 | drbd_send_protocol(mdev); | 902 | if (!drbd_send_protocol(mdev)) |
| 903 | return -1; | ||
| 903 | drbd_send_sync_param(mdev, &mdev->sync_conf); | 904 | drbd_send_sync_param(mdev, &mdev->sync_conf); |
| 904 | drbd_send_sizes(mdev, 0); | 905 | drbd_send_sizes(mdev, 0); |
| 905 | drbd_send_uuids(mdev); | 906 | drbd_send_uuids(mdev); |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 7d521e1d17e1..b827c976dc62 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
| @@ -252,6 +252,18 @@ static void pca953x_irq_bus_lock(unsigned int irq) | |||
| 252 | static void pca953x_irq_bus_sync_unlock(unsigned int irq) | 252 | static void pca953x_irq_bus_sync_unlock(unsigned int irq) |
| 253 | { | 253 | { |
| 254 | struct pca953x_chip *chip = get_irq_chip_data(irq); | 254 | struct pca953x_chip *chip = get_irq_chip_data(irq); |
| 255 | uint16_t new_irqs; | ||
| 256 | uint16_t level; | ||
| 257 | |||
| 258 | /* Look for any newly setup interrupt */ | ||
| 259 | new_irqs = chip->irq_trig_fall | chip->irq_trig_raise; | ||
| 260 | new_irqs &= ~chip->reg_direction; | ||
| 261 | |||
| 262 | while (new_irqs) { | ||
| 263 | level = __ffs(new_irqs); | ||
| 264 | pca953x_gpio_direction_input(&chip->gpio_chip, level); | ||
| 265 | new_irqs &= ~(1 << level); | ||
| 266 | } | ||
| 255 | 267 | ||
| 256 | mutex_unlock(&chip->irq_lock); | 268 | mutex_unlock(&chip->irq_lock); |
| 257 | } | 269 | } |
| @@ -278,7 +290,7 @@ static int pca953x_irq_set_type(unsigned int irq, unsigned int type) | |||
| 278 | else | 290 | else |
| 279 | chip->irq_trig_raise &= ~mask; | 291 | chip->irq_trig_raise &= ~mask; |
| 280 | 292 | ||
| 281 | return pca953x_gpio_direction_input(&chip->gpio_chip, level); | 293 | return 0; |
| 282 | } | 294 | } |
| 283 | 295 | ||
| 284 | static struct irq_chip pca953x_irq_chip = { | 296 | static struct irq_chip pca953x_irq_chip = { |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 3bd872761567..a263b7070fc6 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
| @@ -476,6 +476,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc) | |||
| 476 | unsigned long irqflags; | 476 | unsigned long irqflags; |
| 477 | 477 | ||
| 478 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 478 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
| 479 | dev->driver->disable_vblank(dev, crtc); | ||
| 479 | DRM_WAKEUP(&dev->vbl_queue[crtc]); | 480 | DRM_WAKEUP(&dev->vbl_queue[crtc]); |
| 480 | dev->vblank_enabled[crtc] = 0; | 481 | dev->vblank_enabled[crtc] = 0; |
| 481 | dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc); | 482 | dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc); |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index bd75f99bd65e..eaf1f6bc44f1 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
| @@ -324,13 +324,12 @@ void r300_gpu_init(struct radeon_device *rdev) | |||
| 324 | uint32_t gb_tile_config, tmp; | 324 | uint32_t gb_tile_config, tmp; |
| 325 | 325 | ||
| 326 | r100_hdp_reset(rdev); | 326 | r100_hdp_reset(rdev); |
| 327 | /* FIXME: rv380 one pipes ? */ | ||
| 328 | if ((rdev->family == CHIP_R300 && rdev->pdev->device != 0x4144) || | 327 | if ((rdev->family == CHIP_R300 && rdev->pdev->device != 0x4144) || |
| 329 | (rdev->family == CHIP_R350)) { | 328 | (rdev->family == CHIP_R350 && rdev->pdev->device != 0x4148)) { |
| 330 | /* r300,r350 */ | 329 | /* r300,r350 */ |
| 331 | rdev->num_gb_pipes = 2; | 330 | rdev->num_gb_pipes = 2; |
| 332 | } else { | 331 | } else { |
| 333 | /* rv350,rv370,rv380,r300 AD */ | 332 | /* rv350,rv370,rv380,r300 AD, r350 AH */ |
| 334 | rdev->num_gb_pipes = 1; | 333 | rdev->num_gb_pipes = 1; |
| 335 | } | 334 | } |
| 336 | rdev->num_z_pipes = 1; | 335 | rdev->num_z_pipes = 1; |
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c index ea46d558e8f3..c5c2742e4140 100644 --- a/drivers/gpu/drm/radeon/r300_cmdbuf.c +++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c | |||
| @@ -921,7 +921,7 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, | |||
| 921 | 921 | ||
| 922 | ptr_addr = drm_buffer_read_object(cmdbuf->buffer, | 922 | ptr_addr = drm_buffer_read_object(cmdbuf->buffer, |
| 923 | sizeof(stack_ptr_addr), &stack_ptr_addr); | 923 | sizeof(stack_ptr_addr), &stack_ptr_addr); |
| 924 | ref_age_base = (u32 *)(unsigned long)*ptr_addr; | 924 | ref_age_base = (u32 *)(unsigned long)get_unaligned(ptr_addr); |
| 925 | 925 | ||
| 926 | for (i=0; i < header.scratch.n_bufs; i++) { | 926 | for (i=0; i < header.scratch.n_bufs; i++) { |
| 927 | buf_idx = drm_buffer_pointer_to_dword(cmdbuf->buffer, 0); | 927 | buf_idx = drm_buffer_pointer_to_dword(cmdbuf->buffer, 0); |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 3dc968c9f5a4..c2bda4ad62e7 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
| @@ -59,6 +59,12 @@ void r420_pipes_init(struct radeon_device *rdev) | |||
| 59 | /* get max number of pipes */ | 59 | /* get max number of pipes */ |
| 60 | gb_pipe_select = RREG32(0x402C); | 60 | gb_pipe_select = RREG32(0x402C); |
| 61 | num_pipes = ((gb_pipe_select >> 12) & 3) + 1; | 61 | num_pipes = ((gb_pipe_select >> 12) & 3) + 1; |
| 62 | |||
| 63 | /* SE chips have 1 pipe */ | ||
| 64 | if ((rdev->pdev->device == 0x5e4c) || | ||
| 65 | (rdev->pdev->device == 0x5e4f)) | ||
| 66 | num_pipes = 1; | ||
| 67 | |||
| 62 | rdev->num_gb_pipes = num_pipes; | 68 | rdev->num_gb_pipes = num_pipes; |
| 63 | tmp = 0; | 69 | tmp = 0; |
| 64 | switch (num_pipes) { | 70 | switch (num_pipes) { |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index 419630dd2075..2f042a3c0e62 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
| @@ -435,14 +435,19 @@ static void radeon_init_pipes(struct drm_device *dev) | |||
| 435 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { | 435 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { |
| 436 | gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); | 436 | gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); |
| 437 | dev_priv->num_gb_pipes = ((gb_pipe_sel >> 12) & 0x3) + 1; | 437 | dev_priv->num_gb_pipes = ((gb_pipe_sel >> 12) & 0x3) + 1; |
| 438 | /* SE cards have 1 pipe */ | ||
| 439 | if ((dev->pdev->device == 0x5e4c) || | ||
| 440 | (dev->pdev->device == 0x5e4f)) | ||
| 441 | dev_priv->num_gb_pipes = 1; | ||
| 438 | } else { | 442 | } else { |
| 439 | /* R3xx */ | 443 | /* R3xx */ |
| 440 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300 && | 444 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300 && |
| 441 | dev->pdev->device != 0x4144) || | 445 | dev->pdev->device != 0x4144) || |
| 442 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350)) { | 446 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350 && |
| 447 | dev->pdev->device != 0x4148)) { | ||
| 443 | dev_priv->num_gb_pipes = 2; | 448 | dev_priv->num_gb_pipes = 2; |
| 444 | } else { | 449 | } else { |
| 445 | /* RV3xx/R300 AD */ | 450 | /* RV3xx/R300 AD/R350 AH */ |
| 446 | dev_priv->num_gb_pipes = 1; | 451 | dev_priv->num_gb_pipes = 1; |
| 447 | } | 452 | } |
| 448 | } | 453 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index b8d672828246..bb1c122cad21 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -86,12 +86,12 @@ static void evergreen_crtc_load_lut(struct drm_crtc *crtc) | |||
| 86 | WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN + radeon_crtc->crtc_offset, 0xffff); | 86 | WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN + radeon_crtc->crtc_offset, 0xffff); |
| 87 | WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_RED + radeon_crtc->crtc_offset, 0xffff); | 87 | WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_RED + radeon_crtc->crtc_offset, 0xffff); |
| 88 | 88 | ||
| 89 | WREG32(EVERGREEN_DC_LUT_RW_MODE, radeon_crtc->crtc_id); | 89 | WREG32(EVERGREEN_DC_LUT_RW_MODE + radeon_crtc->crtc_offset, 0); |
| 90 | WREG32(EVERGREEN_DC_LUT_WRITE_EN_MASK, 0x00000007); | 90 | WREG32(EVERGREEN_DC_LUT_WRITE_EN_MASK + radeon_crtc->crtc_offset, 0x00000007); |
| 91 | 91 | ||
| 92 | WREG32(EVERGREEN_DC_LUT_RW_INDEX, 0); | 92 | WREG32(EVERGREEN_DC_LUT_RW_INDEX + radeon_crtc->crtc_offset, 0); |
| 93 | for (i = 0; i < 256; i++) { | 93 | for (i = 0; i < 256; i++) { |
| 94 | WREG32(EVERGREEN_DC_LUT_30_COLOR, | 94 | WREG32(EVERGREEN_DC_LUT_30_COLOR + radeon_crtc->crtc_offset, |
| 95 | (radeon_crtc->lut_r[i] << 20) | | 95 | (radeon_crtc->lut_r[i] << 20) | |
| 96 | (radeon_crtc->lut_g[i] << 10) | | 96 | (radeon_crtc->lut_g[i] << 10) | |
| 97 | (radeon_crtc->lut_b[i] << 0)); | 97 | (radeon_crtc->lut_b[i] << 0)); |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 30293bec0801..fed7b8084779 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
| @@ -1326,7 +1326,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
| 1326 | 1326 | ||
| 1327 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 1327 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
| 1328 | 1328 | ||
| 1329 | if (ASIC_IS_AVIVO(rdev)) { | 1329 | if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE4(rdev)) { |
| 1330 | if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) | 1330 | if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) |
| 1331 | atombios_yuv_setup(encoder, true); | 1331 | atombios_yuv_setup(encoder, true); |
| 1332 | else | 1332 | else |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index d3657dcfdd26..c633319f98ed 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
| @@ -165,7 +165,7 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc) | |||
| 165 | { | 165 | { |
| 166 | struct radeon_device *rdev = dev->dev_private; | 166 | struct radeon_device *rdev = dev->dev_private; |
| 167 | 167 | ||
| 168 | if (crtc < 0 || crtc > 1) { | 168 | if (crtc < 0 || crtc >= rdev->num_crtc) { |
| 169 | DRM_ERROR("Invalid crtc %d\n", crtc); | 169 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 170 | return -EINVAL; | 170 | return -EINVAL; |
| 171 | } | 171 | } |
| @@ -177,7 +177,7 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc) | |||
| 177 | { | 177 | { |
| 178 | struct radeon_device *rdev = dev->dev_private; | 178 | struct radeon_device *rdev = dev->dev_private; |
| 179 | 179 | ||
| 180 | if (crtc < 0 || crtc > 1) { | 180 | if (crtc < 0 || crtc >= rdev->num_crtc) { |
| 181 | DRM_ERROR("Invalid crtc %d\n", crtc); | 181 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 182 | return -EINVAL; | 182 | return -EINVAL; |
| 183 | } | 183 | } |
| @@ -191,7 +191,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc) | |||
| 191 | { | 191 | { |
| 192 | struct radeon_device *rdev = dev->dev_private; | 192 | struct radeon_device *rdev = dev->dev_private; |
| 193 | 193 | ||
| 194 | if (crtc < 0 || crtc > 1) { | 194 | if (crtc < 0 || crtc >= rdev->num_crtc) { |
| 195 | DRM_ERROR("Invalid crtc %d\n", crtc); | 195 | DRM_ERROR("Invalid crtc %d\n", crtc); |
| 196 | return; | 196 | return; |
| 197 | } | 197 | } |
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile index 82d1e4de475b..4521b1ecce45 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | # Core functionality. | 5 | # Core functionality. |
| 6 | obj-$(CONFIG_MTD) += mtd.o | 6 | obj-$(CONFIG_MTD) += mtd.o |
| 7 | mtd-y := mtdcore.o mtdsuper.o mtdbdi.o | 7 | mtd-y := mtdcore.o mtdsuper.o |
| 8 | mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o | 8 | mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o |
| 9 | 9 | ||
| 10 | obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o | 10 | obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o |
diff --git a/drivers/mtd/internal.h b/drivers/mtd/internal.h index c658fe7216b5..e69de29bb2d1 100644 --- a/drivers/mtd/internal.h +++ b/drivers/mtd/internal.h | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | /* Internal MTD definitions | ||
| 2 | * | ||
| 3 | * Copyright © 2006 Red Hat, Inc. All Rights Reserved. | ||
| 4 | * Written by David Howells (dhowells@redhat.com) | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the License, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * mtdbdi.c | ||
| 14 | */ | ||
| 15 | extern struct backing_dev_info mtd_bdi_unmappable; | ||
| 16 | extern struct backing_dev_info mtd_bdi_ro_mappable; | ||
| 17 | extern struct backing_dev_info mtd_bdi_rw_mappable; | ||
diff --git a/drivers/mtd/mtdbdi.c b/drivers/mtd/mtdbdi.c index 5ca5aed0b225..e69de29bb2d1 100644 --- a/drivers/mtd/mtdbdi.c +++ b/drivers/mtd/mtdbdi.c | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | /* MTD backing device capabilities | ||
| 2 | * | ||
| 3 | * Copyright © 2006 Red Hat, Inc. All Rights Reserved. | ||
| 4 | * Written by David Howells (dhowells@redhat.com) | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the License, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/backing-dev.h> | ||
| 13 | #include <linux/mtd/mtd.h> | ||
| 14 | #include "internal.h" | ||
| 15 | |||
| 16 | /* | ||
| 17 | * backing device capabilities for non-mappable devices (such as NAND flash) | ||
| 18 | * - permits private mappings, copies are taken of the data | ||
| 19 | */ | ||
| 20 | struct backing_dev_info mtd_bdi_unmappable = { | ||
| 21 | .capabilities = BDI_CAP_MAP_COPY, | ||
| 22 | }; | ||
| 23 | |||
| 24 | /* | ||
| 25 | * backing device capabilities for R/O mappable devices (such as ROM) | ||
| 26 | * - permits private mappings, copies are taken of the data | ||
| 27 | * - permits non-writable shared mappings | ||
| 28 | */ | ||
| 29 | struct backing_dev_info mtd_bdi_ro_mappable = { | ||
| 30 | .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | | ||
| 31 | BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP), | ||
| 32 | }; | ||
| 33 | |||
| 34 | /* | ||
| 35 | * backing device capabilities for writable mappable devices (such as RAM) | ||
| 36 | * - permits private mappings, copies are taken of the data | ||
| 37 | * - permits non-writable shared mappings | ||
| 38 | */ | ||
| 39 | struct backing_dev_info mtd_bdi_rw_mappable = { | ||
| 40 | .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | | ||
| 41 | BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP | | ||
| 42 | BDI_CAP_WRITE_MAP), | ||
| 43 | }; | ||
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 5b38b17d2229..b177e750efc3 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | * Core registration and callback routines for MTD | 2 | * Core registration and callback routines for MTD |
| 3 | * drivers and users. | 3 | * drivers and users. |
| 4 | * | 4 | * |
| 5 | * bdi bits are: | ||
| 6 | * Copyright © 2006 Red Hat, Inc. All Rights Reserved. | ||
| 7 | * Written by David Howells (dhowells@redhat.com) | ||
| 5 | */ | 8 | */ |
| 6 | 9 | ||
| 7 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| @@ -16,11 +19,39 @@ | |||
| 16 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 17 | #include <linux/mtd/compatmac.h> | 20 | #include <linux/mtd/compatmac.h> |
| 18 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
| 22 | #include <linux/backing-dev.h> | ||
| 19 | 23 | ||
| 20 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
| 21 | #include "internal.h" | ||
| 22 | 25 | ||
| 23 | #include "mtdcore.h" | 26 | #include "mtdcore.h" |
| 27 | /* | ||
| 28 | * backing device capabilities for non-mappable devices (such as NAND flash) | ||
| 29 | * - permits private mappings, copies are taken of the data | ||
| 30 | */ | ||
| 31 | struct backing_dev_info mtd_bdi_unmappable = { | ||
| 32 | .capabilities = BDI_CAP_MAP_COPY, | ||
| 33 | }; | ||
| 34 | |||
| 35 | /* | ||
| 36 | * backing device capabilities for R/O mappable devices (such as ROM) | ||
| 37 | * - permits private mappings, copies are taken of the data | ||
| 38 | * - permits non-writable shared mappings | ||
| 39 | */ | ||
| 40 | struct backing_dev_info mtd_bdi_ro_mappable = { | ||
| 41 | .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | | ||
| 42 | BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP), | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* | ||
| 46 | * backing device capabilities for writable mappable devices (such as RAM) | ||
| 47 | * - permits private mappings, copies are taken of the data | ||
| 48 | * - permits non-writable shared mappings | ||
| 49 | */ | ||
| 50 | struct backing_dev_info mtd_bdi_rw_mappable = { | ||
| 51 | .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | | ||
| 52 | BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP | | ||
| 53 | BDI_CAP_WRITE_MAP), | ||
| 54 | }; | ||
| 24 | 55 | ||
| 25 | static int mtd_cls_suspend(struct device *dev, pm_message_t state); | 56 | static int mtd_cls_suspend(struct device *dev, pm_message_t state); |
| 26 | static int mtd_cls_resume(struct device *dev); | 57 | static int mtd_cls_resume(struct device *dev); |
| @@ -628,20 +659,55 @@ done: | |||
| 628 | /*====================================================================*/ | 659 | /*====================================================================*/ |
| 629 | /* Init code */ | 660 | /* Init code */ |
| 630 | 661 | ||
| 662 | static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name) | ||
| 663 | { | ||
| 664 | int ret; | ||
| 665 | |||
| 666 | ret = bdi_init(bdi); | ||
| 667 | if (!ret) | ||
| 668 | ret = bdi_register(bdi, NULL, name); | ||
| 669 | |||
| 670 | if (ret) | ||
| 671 | bdi_destroy(bdi); | ||
| 672 | |||
| 673 | return ret; | ||
| 674 | } | ||
| 675 | |||
| 631 | static int __init init_mtd(void) | 676 | static int __init init_mtd(void) |
| 632 | { | 677 | { |
| 633 | int ret; | 678 | int ret; |
| 679 | |||
| 634 | ret = class_register(&mtd_class); | 680 | ret = class_register(&mtd_class); |
| 681 | if (ret) | ||
| 682 | goto err_reg; | ||
| 683 | |||
| 684 | ret = mtd_bdi_init(&mtd_bdi_unmappable, "mtd-unmap"); | ||
| 685 | if (ret) | ||
| 686 | goto err_bdi1; | ||
| 687 | |||
| 688 | ret = mtd_bdi_init(&mtd_bdi_ro_mappable, "mtd-romap"); | ||
| 689 | if (ret) | ||
| 690 | goto err_bdi2; | ||
| 691 | |||
| 692 | ret = mtd_bdi_init(&mtd_bdi_rw_mappable, "mtd-rwmap"); | ||
| 693 | if (ret) | ||
| 694 | goto err_bdi3; | ||
| 635 | 695 | ||
| 636 | if (ret) { | ||
| 637 | pr_err("Error registering mtd class: %d\n", ret); | ||
| 638 | return ret; | ||
| 639 | } | ||
| 640 | #ifdef CONFIG_PROC_FS | 696 | #ifdef CONFIG_PROC_FS |
| 641 | if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) | 697 | if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) |
| 642 | proc_mtd->read_proc = mtd_read_proc; | 698 | proc_mtd->read_proc = mtd_read_proc; |
| 643 | #endif /* CONFIG_PROC_FS */ | 699 | #endif /* CONFIG_PROC_FS */ |
| 644 | return 0; | 700 | return 0; |
| 701 | |||
| 702 | err_bdi3: | ||
| 703 | bdi_destroy(&mtd_bdi_ro_mappable); | ||
| 704 | err_bdi2: | ||
| 705 | bdi_destroy(&mtd_bdi_unmappable); | ||
| 706 | err_bdi1: | ||
| 707 | class_unregister(&mtd_class); | ||
| 708 | err_reg: | ||
| 709 | pr_err("Error registering mtd class or bdi: %d\n", ret); | ||
| 710 | return ret; | ||
| 645 | } | 711 | } |
| 646 | 712 | ||
| 647 | static void __exit cleanup_mtd(void) | 713 | static void __exit cleanup_mtd(void) |
| @@ -651,6 +717,9 @@ static void __exit cleanup_mtd(void) | |||
| 651 | remove_proc_entry( "mtd", NULL); | 717 | remove_proc_entry( "mtd", NULL); |
| 652 | #endif /* CONFIG_PROC_FS */ | 718 | #endif /* CONFIG_PROC_FS */ |
| 653 | class_unregister(&mtd_class); | 719 | class_unregister(&mtd_class); |
| 720 | bdi_destroy(&mtd_bdi_unmappable); | ||
| 721 | bdi_destroy(&mtd_bdi_ro_mappable); | ||
| 722 | bdi_destroy(&mtd_bdi_rw_mappable); | ||
| 654 | } | 723 | } |
| 655 | 724 | ||
| 656 | module_init(init_mtd); | 725 | module_init(init_mtd); |
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c index af8b42e0a55b..7c003191fca4 100644 --- a/drivers/mtd/mtdsuper.c +++ b/drivers/mtd/mtdsuper.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/mtd/super.h> | 13 | #include <linux/mtd/super.h> |
| 14 | #include <linux/namei.h> | 14 | #include <linux/namei.h> |
| 15 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
| 16 | #include <linux/slab.h> | ||
| 16 | 17 | ||
| 17 | /* | 18 | /* |
| 18 | * compare superblocks to see if they're equivalent | 19 | * compare superblocks to see if they're equivalent |
| @@ -44,6 +45,7 @@ static int get_sb_mtd_set(struct super_block *sb, void *_mtd) | |||
| 44 | 45 | ||
| 45 | sb->s_mtd = mtd; | 46 | sb->s_mtd = mtd; |
| 46 | sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index); | 47 | sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index); |
| 48 | sb->s_bdi = mtd->backing_dev_info; | ||
| 47 | return 0; | 49 | return 0; |
| 48 | } | 50 | } |
| 49 | 51 | ||
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index a257babd1bb4..ac90a3828f69 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
| @@ -58,8 +58,8 @@ | |||
| 58 | #include "bnx2_fw.h" | 58 | #include "bnx2_fw.h" |
| 59 | 59 | ||
| 60 | #define DRV_MODULE_NAME "bnx2" | 60 | #define DRV_MODULE_NAME "bnx2" |
| 61 | #define DRV_MODULE_VERSION "2.0.8" | 61 | #define DRV_MODULE_VERSION "2.0.9" |
| 62 | #define DRV_MODULE_RELDATE "Feb 15, 2010" | 62 | #define DRV_MODULE_RELDATE "April 27, 2010" |
| 63 | #define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-5.0.0.j6.fw" | 63 | #define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-5.0.0.j6.fw" |
| 64 | #define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-5.0.0.j3.fw" | 64 | #define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-5.0.0.j3.fw" |
| 65 | #define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-5.0.0.j9.fw" | 65 | #define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-5.0.0.j9.fw" |
| @@ -651,9 +651,10 @@ bnx2_napi_enable(struct bnx2 *bp) | |||
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | static void | 653 | static void |
| 654 | bnx2_netif_stop(struct bnx2 *bp) | 654 | bnx2_netif_stop(struct bnx2 *bp, bool stop_cnic) |
| 655 | { | 655 | { |
| 656 | bnx2_cnic_stop(bp); | 656 | if (stop_cnic) |
| 657 | bnx2_cnic_stop(bp); | ||
| 657 | if (netif_running(bp->dev)) { | 658 | if (netif_running(bp->dev)) { |
| 658 | int i; | 659 | int i; |
| 659 | 660 | ||
| @@ -671,14 +672,15 @@ bnx2_netif_stop(struct bnx2 *bp) | |||
| 671 | } | 672 | } |
| 672 | 673 | ||
| 673 | static void | 674 | static void |
| 674 | bnx2_netif_start(struct bnx2 *bp) | 675 | bnx2_netif_start(struct bnx2 *bp, bool start_cnic) |
| 675 | { | 676 | { |
| 676 | if (atomic_dec_and_test(&bp->intr_sem)) { | 677 | if (atomic_dec_and_test(&bp->intr_sem)) { |
| 677 | if (netif_running(bp->dev)) { | 678 | if (netif_running(bp->dev)) { |
| 678 | netif_tx_wake_all_queues(bp->dev); | 679 | netif_tx_wake_all_queues(bp->dev); |
| 679 | bnx2_napi_enable(bp); | 680 | bnx2_napi_enable(bp); |
| 680 | bnx2_enable_int(bp); | 681 | bnx2_enable_int(bp); |
| 681 | bnx2_cnic_start(bp); | 682 | if (start_cnic) |
| 683 | bnx2_cnic_start(bp); | ||
| 682 | } | 684 | } |
| 683 | } | 685 | } |
| 684 | } | 686 | } |
| @@ -4759,8 +4761,12 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) | |||
| 4759 | rc = bnx2_alloc_bad_rbuf(bp); | 4761 | rc = bnx2_alloc_bad_rbuf(bp); |
| 4760 | } | 4762 | } |
| 4761 | 4763 | ||
| 4762 | if (bp->flags & BNX2_FLAG_USING_MSIX) | 4764 | if (bp->flags & BNX2_FLAG_USING_MSIX) { |
| 4763 | bnx2_setup_msix_tbl(bp); | 4765 | bnx2_setup_msix_tbl(bp); |
| 4766 | /* Prevent MSIX table reads and write from timing out */ | ||
| 4767 | REG_WR(bp, BNX2_MISC_ECO_HW_CTL, | ||
| 4768 | BNX2_MISC_ECO_HW_CTL_LARGE_GRC_TMOUT_EN); | ||
| 4769 | } | ||
| 4764 | 4770 | ||
| 4765 | return rc; | 4771 | return rc; |
| 4766 | } | 4772 | } |
| @@ -6273,12 +6279,12 @@ bnx2_reset_task(struct work_struct *work) | |||
| 6273 | return; | 6279 | return; |
| 6274 | } | 6280 | } |
| 6275 | 6281 | ||
| 6276 | bnx2_netif_stop(bp); | 6282 | bnx2_netif_stop(bp, true); |
| 6277 | 6283 | ||
| 6278 | bnx2_init_nic(bp, 1); | 6284 | bnx2_init_nic(bp, 1); |
| 6279 | 6285 | ||
| 6280 | atomic_set(&bp->intr_sem, 1); | 6286 | atomic_set(&bp->intr_sem, 1); |
| 6281 | bnx2_netif_start(bp); | 6287 | bnx2_netif_start(bp, true); |
| 6282 | rtnl_unlock(); | 6288 | rtnl_unlock(); |
| 6283 | } | 6289 | } |
| 6284 | 6290 | ||
| @@ -6320,7 +6326,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp) | |||
| 6320 | struct bnx2 *bp = netdev_priv(dev); | 6326 | struct bnx2 *bp = netdev_priv(dev); |
| 6321 | 6327 | ||
| 6322 | if (netif_running(dev)) | 6328 | if (netif_running(dev)) |
| 6323 | bnx2_netif_stop(bp); | 6329 | bnx2_netif_stop(bp, false); |
| 6324 | 6330 | ||
| 6325 | bp->vlgrp = vlgrp; | 6331 | bp->vlgrp = vlgrp; |
| 6326 | 6332 | ||
| @@ -6331,7 +6337,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp) | |||
| 6331 | if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN) | 6337 | if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN) |
| 6332 | bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); | 6338 | bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); |
| 6333 | 6339 | ||
| 6334 | bnx2_netif_start(bp); | 6340 | bnx2_netif_start(bp, false); |
| 6335 | } | 6341 | } |
| 6336 | #endif | 6342 | #endif |
| 6337 | 6343 | ||
| @@ -7051,9 +7057,9 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) | |||
| 7051 | bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS; | 7057 | bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS; |
| 7052 | 7058 | ||
| 7053 | if (netif_running(bp->dev)) { | 7059 | if (netif_running(bp->dev)) { |
| 7054 | bnx2_netif_stop(bp); | 7060 | bnx2_netif_stop(bp, true); |
| 7055 | bnx2_init_nic(bp, 0); | 7061 | bnx2_init_nic(bp, 0); |
| 7056 | bnx2_netif_start(bp); | 7062 | bnx2_netif_start(bp, true); |
| 7057 | } | 7063 | } |
| 7058 | 7064 | ||
| 7059 | return 0; | 7065 | return 0; |
| @@ -7083,7 +7089,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx) | |||
| 7083 | /* Reset will erase chipset stats; save them */ | 7089 | /* Reset will erase chipset stats; save them */ |
| 7084 | bnx2_save_stats(bp); | 7090 | bnx2_save_stats(bp); |
| 7085 | 7091 | ||
| 7086 | bnx2_netif_stop(bp); | 7092 | bnx2_netif_stop(bp, true); |
| 7087 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); | 7093 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); |
| 7088 | bnx2_free_skbs(bp); | 7094 | bnx2_free_skbs(bp); |
| 7089 | bnx2_free_mem(bp); | 7095 | bnx2_free_mem(bp); |
| @@ -7111,7 +7117,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx) | |||
| 7111 | bnx2_setup_cnic_irq_info(bp); | 7117 | bnx2_setup_cnic_irq_info(bp); |
| 7112 | mutex_unlock(&bp->cnic_lock); | 7118 | mutex_unlock(&bp->cnic_lock); |
| 7113 | #endif | 7119 | #endif |
| 7114 | bnx2_netif_start(bp); | 7120 | bnx2_netif_start(bp, true); |
| 7115 | } | 7121 | } |
| 7116 | return 0; | 7122 | return 0; |
| 7117 | } | 7123 | } |
| @@ -7364,7 +7370,7 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf) | |||
| 7364 | if (etest->flags & ETH_TEST_FL_OFFLINE) { | 7370 | if (etest->flags & ETH_TEST_FL_OFFLINE) { |
| 7365 | int i; | 7371 | int i; |
| 7366 | 7372 | ||
| 7367 | bnx2_netif_stop(bp); | 7373 | bnx2_netif_stop(bp, true); |
| 7368 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_DIAG); | 7374 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_DIAG); |
| 7369 | bnx2_free_skbs(bp); | 7375 | bnx2_free_skbs(bp); |
| 7370 | 7376 | ||
| @@ -7383,7 +7389,7 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf) | |||
| 7383 | bnx2_shutdown_chip(bp); | 7389 | bnx2_shutdown_chip(bp); |
| 7384 | else { | 7390 | else { |
| 7385 | bnx2_init_nic(bp, 1); | 7391 | bnx2_init_nic(bp, 1); |
| 7386 | bnx2_netif_start(bp); | 7392 | bnx2_netif_start(bp, true); |
| 7387 | } | 7393 | } |
| 7388 | 7394 | ||
| 7389 | /* wait for link up */ | 7395 | /* wait for link up */ |
| @@ -8377,7 +8383,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 8377 | return 0; | 8383 | return 0; |
| 8378 | 8384 | ||
| 8379 | flush_scheduled_work(); | 8385 | flush_scheduled_work(); |
| 8380 | bnx2_netif_stop(bp); | 8386 | bnx2_netif_stop(bp, true); |
| 8381 | netif_device_detach(dev); | 8387 | netif_device_detach(dev); |
| 8382 | del_timer_sync(&bp->timer); | 8388 | del_timer_sync(&bp->timer); |
| 8383 | bnx2_shutdown_chip(bp); | 8389 | bnx2_shutdown_chip(bp); |
| @@ -8399,7 +8405,7 @@ bnx2_resume(struct pci_dev *pdev) | |||
| 8399 | bnx2_set_power_state(bp, PCI_D0); | 8405 | bnx2_set_power_state(bp, PCI_D0); |
| 8400 | netif_device_attach(dev); | 8406 | netif_device_attach(dev); |
| 8401 | bnx2_init_nic(bp, 1); | 8407 | bnx2_init_nic(bp, 1); |
| 8402 | bnx2_netif_start(bp); | 8408 | bnx2_netif_start(bp, true); |
| 8403 | return 0; | 8409 | return 0; |
| 8404 | } | 8410 | } |
| 8405 | 8411 | ||
| @@ -8426,7 +8432,7 @@ static pci_ers_result_t bnx2_io_error_detected(struct pci_dev *pdev, | |||
| 8426 | } | 8432 | } |
| 8427 | 8433 | ||
| 8428 | if (netif_running(dev)) { | 8434 | if (netif_running(dev)) { |
| 8429 | bnx2_netif_stop(bp); | 8435 | bnx2_netif_stop(bp, true); |
| 8430 | del_timer_sync(&bp->timer); | 8436 | del_timer_sync(&bp->timer); |
| 8431 | bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_RESET); | 8437 | bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_RESET); |
| 8432 | } | 8438 | } |
| @@ -8483,7 +8489,7 @@ static void bnx2_io_resume(struct pci_dev *pdev) | |||
| 8483 | 8489 | ||
| 8484 | rtnl_lock(); | 8490 | rtnl_lock(); |
| 8485 | if (netif_running(dev)) | 8491 | if (netif_running(dev)) |
| 8486 | bnx2_netif_start(bp); | 8492 | bnx2_netif_start(bp, true); |
| 8487 | 8493 | ||
| 8488 | netif_device_attach(dev); | 8494 | netif_device_attach(dev); |
| 8489 | rtnl_unlock(); | 8495 | rtnl_unlock(); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index aced6c5e635c..e3f1b8566495 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
| @@ -439,7 +439,7 @@ static void free_irq_resources(struct adapter *adapter) | |||
| 439 | static int await_mgmt_replies(struct adapter *adap, unsigned long init_cnt, | 439 | static int await_mgmt_replies(struct adapter *adap, unsigned long init_cnt, |
| 440 | unsigned long n) | 440 | unsigned long n) |
| 441 | { | 441 | { |
| 442 | int attempts = 5; | 442 | int attempts = 10; |
| 443 | 443 | ||
| 444 | while (adap->sge.qs[0].rspq.offload_pkts < init_cnt + n) { | 444 | while (adap->sge.qs[0].rspq.offload_pkts < init_cnt + n) { |
| 445 | if (!--attempts) | 445 | if (!--attempts) |
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index 712ccc66ba25..90155552ea09 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
| @@ -336,7 +336,6 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter) | |||
| 336 | struct e1000_hw *hw = &adapter->hw; | 336 | struct e1000_hw *hw = &adapter->hw; |
| 337 | static int global_quad_port_a; /* global port a indication */ | 337 | static int global_quad_port_a; /* global port a indication */ |
| 338 | struct pci_dev *pdev = adapter->pdev; | 338 | struct pci_dev *pdev = adapter->pdev; |
| 339 | u16 eeprom_data = 0; | ||
| 340 | int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; | 339 | int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; |
| 341 | s32 rc; | 340 | s32 rc; |
| 342 | 341 | ||
| @@ -387,16 +386,15 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter) | |||
| 387 | if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) | 386 | if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) |
| 388 | adapter->flags &= ~FLAG_HAS_WOL; | 387 | adapter->flags &= ~FLAG_HAS_WOL; |
| 389 | break; | 388 | break; |
| 390 | |||
| 391 | case e1000_82573: | 389 | case e1000_82573: |
| 390 | case e1000_82574: | ||
| 391 | case e1000_82583: | ||
| 392 | /* Disable ASPM L0s due to hardware errata */ | ||
| 393 | e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S); | ||
| 394 | |||
| 392 | if (pdev->device == E1000_DEV_ID_82573L) { | 395 | if (pdev->device == E1000_DEV_ID_82573L) { |
| 393 | if (e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1, | 396 | adapter->flags |= FLAG_HAS_JUMBO_FRAMES; |
| 394 | &eeprom_data) < 0) | 397 | adapter->max_hw_frame_size = DEFAULT_JUMBO; |
| 395 | break; | ||
| 396 | if (!(eeprom_data & NVM_WORD1A_ASPM_MASK)) { | ||
| 397 | adapter->flags |= FLAG_HAS_JUMBO_FRAMES; | ||
| 398 | adapter->max_hw_frame_size = DEFAULT_JUMBO; | ||
| 399 | } | ||
| 400 | } | 398 | } |
| 401 | break; | 399 | break; |
| 402 | default: | 400 | default: |
| @@ -1792,6 +1790,7 @@ struct e1000_info e1000_82571_info = { | |||
| 1792 | | FLAG_RESET_OVERWRITES_LAA /* errata */ | 1790 | | FLAG_RESET_OVERWRITES_LAA /* errata */ |
| 1793 | | FLAG_TARC_SPEED_MODE_BIT /* errata */ | 1791 | | FLAG_TARC_SPEED_MODE_BIT /* errata */ |
| 1794 | | FLAG_APME_CHECK_PORT_B, | 1792 | | FLAG_APME_CHECK_PORT_B, |
| 1793 | .flags2 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */ | ||
| 1795 | .pba = 38, | 1794 | .pba = 38, |
| 1796 | .max_hw_frame_size = DEFAULT_JUMBO, | 1795 | .max_hw_frame_size = DEFAULT_JUMBO, |
| 1797 | .get_variants = e1000_get_variants_82571, | 1796 | .get_variants = e1000_get_variants_82571, |
| @@ -1809,6 +1808,7 @@ struct e1000_info e1000_82572_info = { | |||
| 1809 | | FLAG_RX_CSUM_ENABLED | 1808 | | FLAG_RX_CSUM_ENABLED |
| 1810 | | FLAG_HAS_CTRLEXT_ON_LOAD | 1809 | | FLAG_HAS_CTRLEXT_ON_LOAD |
| 1811 | | FLAG_TARC_SPEED_MODE_BIT, /* errata */ | 1810 | | FLAG_TARC_SPEED_MODE_BIT, /* errata */ |
| 1811 | .flags2 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */ | ||
| 1812 | .pba = 38, | 1812 | .pba = 38, |
| 1813 | .max_hw_frame_size = DEFAULT_JUMBO, | 1813 | .max_hw_frame_size = DEFAULT_JUMBO, |
| 1814 | .get_variants = e1000_get_variants_82571, | 1814 | .get_variants = e1000_get_variants_82571, |
| @@ -1820,13 +1820,11 @@ struct e1000_info e1000_82572_info = { | |||
| 1820 | struct e1000_info e1000_82573_info = { | 1820 | struct e1000_info e1000_82573_info = { |
| 1821 | .mac = e1000_82573, | 1821 | .mac = e1000_82573, |
| 1822 | .flags = FLAG_HAS_HW_VLAN_FILTER | 1822 | .flags = FLAG_HAS_HW_VLAN_FILTER |
| 1823 | | FLAG_HAS_JUMBO_FRAMES | ||
| 1824 | | FLAG_HAS_WOL | 1823 | | FLAG_HAS_WOL |
| 1825 | | FLAG_APME_IN_CTRL3 | 1824 | | FLAG_APME_IN_CTRL3 |
| 1826 | | FLAG_RX_CSUM_ENABLED | 1825 | | FLAG_RX_CSUM_ENABLED |
| 1827 | | FLAG_HAS_SMART_POWER_DOWN | 1826 | | FLAG_HAS_SMART_POWER_DOWN |
| 1828 | | FLAG_HAS_AMT | 1827 | | FLAG_HAS_AMT |
| 1829 | | FLAG_HAS_ERT | ||
| 1830 | | FLAG_HAS_SWSM_ON_LOAD, | 1828 | | FLAG_HAS_SWSM_ON_LOAD, |
| 1831 | .pba = 20, | 1829 | .pba = 20, |
| 1832 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, | 1830 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 118bdf483593..ee32b9b27a9f 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/io.h> | 37 | #include <linux/io.h> |
| 38 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
| 39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
| 40 | #include <linux/pci-aspm.h> | ||
| 40 | 41 | ||
| 41 | #include "hw.h" | 42 | #include "hw.h" |
| 42 | 43 | ||
| @@ -374,7 +375,7 @@ struct e1000_adapter { | |||
| 374 | struct e1000_info { | 375 | struct e1000_info { |
| 375 | enum e1000_mac_type mac; | 376 | enum e1000_mac_type mac; |
| 376 | unsigned int flags; | 377 | unsigned int flags; |
| 377 | unsigned int flags2; | 378 | unsigned int flags2; |
| 378 | u32 pba; | 379 | u32 pba; |
| 379 | u32 max_hw_frame_size; | 380 | u32 max_hw_frame_size; |
| 380 | s32 (*get_variants)(struct e1000_adapter *); | 381 | s32 (*get_variants)(struct e1000_adapter *); |
| @@ -421,6 +422,7 @@ struct e1000_info { | |||
| 421 | #define FLAG2_CRC_STRIPPING (1 << 0) | 422 | #define FLAG2_CRC_STRIPPING (1 << 0) |
| 422 | #define FLAG2_HAS_PHY_WAKEUP (1 << 1) | 423 | #define FLAG2_HAS_PHY_WAKEUP (1 << 1) |
| 423 | #define FLAG2_IS_DISCARDING (1 << 2) | 424 | #define FLAG2_IS_DISCARDING (1 << 2) |
| 425 | #define FLAG2_DISABLE_ASPM_L1 (1 << 3) | ||
| 424 | 426 | ||
| 425 | #define E1000_RX_DESC_PS(R, i) \ | 427 | #define E1000_RX_DESC_PS(R, i) \ |
| 426 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 428 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
| @@ -461,6 +463,7 @@ extern void e1000e_update_stats(struct e1000_adapter *adapter); | |||
| 461 | extern bool e1000e_has_link(struct e1000_adapter *adapter); | 463 | extern bool e1000e_has_link(struct e1000_adapter *adapter); |
| 462 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); | 464 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); |
| 463 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); | 465 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); |
| 466 | extern void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); | ||
| 464 | 467 | ||
| 465 | extern unsigned int copybreak; | 468 | extern unsigned int copybreak; |
| 466 | 469 | ||
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 73d43c53015a..fb8fc7d1b50d 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
| @@ -4283,6 +4283,14 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 4283 | return -EINVAL; | 4283 | return -EINVAL; |
| 4284 | } | 4284 | } |
| 4285 | 4285 | ||
| 4286 | /* 82573 Errata 17 */ | ||
| 4287 | if (((adapter->hw.mac.type == e1000_82573) || | ||
| 4288 | (adapter->hw.mac.type == e1000_82574)) && | ||
| 4289 | (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN)) { | ||
| 4290 | adapter->flags2 |= FLAG2_DISABLE_ASPM_L1; | ||
| 4291 | e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L1); | ||
| 4292 | } | ||
| 4293 | |||
| 4286 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) | 4294 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
| 4287 | msleep(1); | 4295 | msleep(1); |
| 4288 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ | 4296 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ |
| @@ -4605,29 +4613,39 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, | |||
| 4605 | } | 4613 | } |
| 4606 | } | 4614 | } |
| 4607 | 4615 | ||
| 4608 | static void e1000e_disable_l1aspm(struct pci_dev *pdev) | 4616 | #ifdef CONFIG_PCIEASPM |
| 4617 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | ||
| 4618 | { | ||
| 4619 | pci_disable_link_state(pdev, state); | ||
| 4620 | } | ||
| 4621 | #else | ||
| 4622 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | ||
| 4609 | { | 4623 | { |
| 4610 | int pos; | 4624 | int pos; |
| 4611 | u16 val; | 4625 | u16 reg16; |
| 4612 | 4626 | ||
| 4613 | /* | 4627 | /* |
| 4614 | * 82573 workaround - disable L1 ASPM on mobile chipsets | 4628 | * Both device and parent should have the same ASPM setting. |
| 4615 | * | 4629 | * Disable ASPM in downstream component first and then upstream. |
| 4616 | * L1 ASPM on various mobile (ich7) chipsets do not behave properly | ||
| 4617 | * resulting in lost data or garbage information on the pci-e link | ||
| 4618 | * level. This could result in (false) bad EEPROM checksum errors, | ||
| 4619 | * long ping times (up to 2s) or even a system freeze/hang. | ||
| 4620 | * | ||
| 4621 | * Unfortunately this feature saves about 1W power consumption when | ||
| 4622 | * active. | ||
| 4623 | */ | 4630 | */ |
| 4624 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 4631 | pos = pci_pcie_cap(pdev); |
| 4625 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &val); | 4632 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); |
| 4626 | if (val & 0x2) { | 4633 | reg16 &= ~state; |
| 4627 | dev_warn(&pdev->dev, "Disabling L1 ASPM\n"); | 4634 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); |
| 4628 | val &= ~0x2; | 4635 | |
| 4629 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, val); | 4636 | pos = pci_pcie_cap(pdev->bus->self); |
| 4630 | } | 4637 | pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, ®16); |
| 4638 | reg16 &= ~state; | ||
| 4639 | pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16); | ||
| 4640 | } | ||
| 4641 | #endif | ||
| 4642 | void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | ||
| 4643 | { | ||
| 4644 | dev_info(&pdev->dev, "Disabling ASPM %s %s\n", | ||
| 4645 | (state & PCIE_LINK_STATE_L0S) ? "L0s" : "", | ||
| 4646 | (state & PCIE_LINK_STATE_L1) ? "L1" : ""); | ||
| 4647 | |||
| 4648 | __e1000e_disable_aspm(pdev, state); | ||
| 4631 | } | 4649 | } |
| 4632 | 4650 | ||
| 4633 | #ifdef CONFIG_PM | 4651 | #ifdef CONFIG_PM |
| @@ -4653,7 +4671,8 @@ static int e1000_resume(struct pci_dev *pdev) | |||
| 4653 | pci_set_power_state(pdev, PCI_D0); | 4671 | pci_set_power_state(pdev, PCI_D0); |
| 4654 | pci_restore_state(pdev); | 4672 | pci_restore_state(pdev); |
| 4655 | pci_save_state(pdev); | 4673 | pci_save_state(pdev); |
| 4656 | e1000e_disable_l1aspm(pdev); | 4674 | if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) |
| 4675 | e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); | ||
| 4657 | 4676 | ||
| 4658 | err = pci_enable_device_mem(pdev); | 4677 | err = pci_enable_device_mem(pdev); |
| 4659 | if (err) { | 4678 | if (err) { |
| @@ -4795,7 +4814,8 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
| 4795 | int err; | 4814 | int err; |
| 4796 | pci_ers_result_t result; | 4815 | pci_ers_result_t result; |
| 4797 | 4816 | ||
| 4798 | e1000e_disable_l1aspm(pdev); | 4817 | if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) |
| 4818 | e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); | ||
| 4799 | err = pci_enable_device_mem(pdev); | 4819 | err = pci_enable_device_mem(pdev); |
| 4800 | if (err) { | 4820 | if (err) { |
| 4801 | dev_err(&pdev->dev, | 4821 | dev_err(&pdev->dev, |
| @@ -4889,13 +4909,6 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) | |||
| 4889 | dev_warn(&adapter->pdev->dev, | 4909 | dev_warn(&adapter->pdev->dev, |
| 4890 | "Warning: detected DSPD enabled in EEPROM\n"); | 4910 | "Warning: detected DSPD enabled in EEPROM\n"); |
| 4891 | } | 4911 | } |
| 4892 | |||
| 4893 | ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf); | ||
| 4894 | if (!ret_val && (le16_to_cpu(buf) & (3 << 2))) { | ||
| 4895 | /* ASPM enable */ | ||
| 4896 | dev_warn(&adapter->pdev->dev, | ||
| 4897 | "Warning: detected ASPM enabled in EEPROM\n"); | ||
| 4898 | } | ||
| 4899 | } | 4912 | } |
| 4900 | 4913 | ||
| 4901 | static const struct net_device_ops e1000e_netdev_ops = { | 4914 | static const struct net_device_ops e1000e_netdev_ops = { |
| @@ -4944,7 +4957,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
| 4944 | u16 eeprom_data = 0; | 4957 | u16 eeprom_data = 0; |
| 4945 | u16 eeprom_apme_mask = E1000_EEPROM_APME; | 4958 | u16 eeprom_apme_mask = E1000_EEPROM_APME; |
| 4946 | 4959 | ||
| 4947 | e1000e_disable_l1aspm(pdev); | 4960 | if (ei->flags2 & FLAG2_DISABLE_ASPM_L1) |
| 4961 | e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); | ||
| 4948 | 4962 | ||
| 4949 | err = pci_enable_device_mem(pdev); | 4963 | err = pci_enable_device_mem(pdev); |
| 4950 | if (err) | 4964 | if (err) |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index df49af382159..4e97ca182997 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -1511,9 +1511,9 @@ static void gfar_halt_nodisable(struct net_device *dev) | |||
| 1511 | tempval |= (DMACTRL_GRS | DMACTRL_GTS); | 1511 | tempval |= (DMACTRL_GRS | DMACTRL_GTS); |
| 1512 | gfar_write(®s->dmactrl, tempval); | 1512 | gfar_write(®s->dmactrl, tempval); |
| 1513 | 1513 | ||
| 1514 | while (!(gfar_read(®s->ievent) & | 1514 | spin_event_timeout(((gfar_read(®s->ievent) & |
| 1515 | (IEVENT_GRSC | IEVENT_GTSC))) | 1515 | (IEVENT_GRSC | IEVENT_GTSC)) == |
| 1516 | cpu_relax(); | 1516 | (IEVENT_GRSC | IEVENT_GTSC)), -1, 0); |
| 1517 | } | 1517 | } |
| 1518 | } | 1518 | } |
| 1519 | 1519 | ||
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index b405a00817c6..12fc0e7ba2ca 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | #define IXGBE_82599_MC_TBL_SIZE 128 | 39 | #define IXGBE_82599_MC_TBL_SIZE 128 |
| 40 | #define IXGBE_82599_VFT_TBL_SIZE 128 | 40 | #define IXGBE_82599_VFT_TBL_SIZE 128 |
| 41 | 41 | ||
| 42 | void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); | ||
| 43 | void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); | ||
| 42 | void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); | 44 | void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); |
| 43 | s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, | 45 | s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, |
| 44 | ixgbe_link_speed speed, | 46 | ixgbe_link_speed speed, |
| @@ -69,8 +71,14 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) | |||
| 69 | if (hw->phy.multispeed_fiber) { | 71 | if (hw->phy.multispeed_fiber) { |
| 70 | /* Set up dual speed SFP+ support */ | 72 | /* Set up dual speed SFP+ support */ |
| 71 | mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber; | 73 | mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber; |
| 74 | mac->ops.disable_tx_laser = | ||
| 75 | &ixgbe_disable_tx_laser_multispeed_fiber; | ||
| 76 | mac->ops.enable_tx_laser = | ||
| 77 | &ixgbe_enable_tx_laser_multispeed_fiber; | ||
| 72 | mac->ops.flap_tx_laser = &ixgbe_flap_tx_laser_multispeed_fiber; | 78 | mac->ops.flap_tx_laser = &ixgbe_flap_tx_laser_multispeed_fiber; |
| 73 | } else { | 79 | } else { |
| 80 | mac->ops.disable_tx_laser = NULL; | ||
| 81 | mac->ops.enable_tx_laser = NULL; | ||
| 74 | mac->ops.flap_tx_laser = NULL; | 82 | mac->ops.flap_tx_laser = NULL; |
| 75 | if ((mac->ops.get_media_type(hw) == | 83 | if ((mac->ops.get_media_type(hw) == |
| 76 | ixgbe_media_type_backplane) && | 84 | ixgbe_media_type_backplane) && |
| @@ -415,6 +423,44 @@ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, | |||
| 415 | return status; | 423 | return status; |
| 416 | } | 424 | } |
| 417 | 425 | ||
| 426 | /** | ||
| 427 | * ixgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser | ||
| 428 | * @hw: pointer to hardware structure | ||
| 429 | * | ||
| 430 | * The base drivers may require better control over SFP+ module | ||
| 431 | * PHY states. This includes selectively shutting down the Tx | ||
| 432 | * laser on the PHY, effectively halting physical link. | ||
| 433 | **/ | ||
| 434 | void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) | ||
| 435 | { | ||
| 436 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); | ||
| 437 | |||
| 438 | /* Disable tx laser; allow 100us to go dark per spec */ | ||
| 439 | esdp_reg |= IXGBE_ESDP_SDP3; | ||
| 440 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | ||
| 441 | IXGBE_WRITE_FLUSH(hw); | ||
| 442 | udelay(100); | ||
| 443 | } | ||
| 444 | |||
| 445 | /** | ||
| 446 | * ixgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser | ||
| 447 | * @hw: pointer to hardware structure | ||
| 448 | * | ||
| 449 | * The base drivers may require better control over SFP+ module | ||
| 450 | * PHY states. This includes selectively turning on the Tx | ||
| 451 | * laser on the PHY, effectively starting physical link. | ||
| 452 | **/ | ||
| 453 | void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) | ||
| 454 | { | ||
| 455 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); | ||
| 456 | |||
| 457 | /* Enable tx laser; allow 100ms to light up */ | ||
| 458 | esdp_reg &= ~IXGBE_ESDP_SDP3; | ||
| 459 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | ||
| 460 | IXGBE_WRITE_FLUSH(hw); | ||
| 461 | msleep(100); | ||
| 462 | } | ||
| 463 | |||
| 418 | /** | 464 | /** |
| 419 | * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser | 465 | * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser |
| 420 | * @hw: pointer to hardware structure | 466 | * @hw: pointer to hardware structure |
| @@ -429,23 +475,11 @@ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, | |||
| 429 | **/ | 475 | **/ |
| 430 | void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) | 476 | void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) |
| 431 | { | 477 | { |
| 432 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); | ||
| 433 | |||
| 434 | hw_dbg(hw, "ixgbe_flap_tx_laser_multispeed_fiber\n"); | 478 | hw_dbg(hw, "ixgbe_flap_tx_laser_multispeed_fiber\n"); |
| 435 | 479 | ||
| 436 | if (hw->mac.autotry_restart) { | 480 | if (hw->mac.autotry_restart) { |
| 437 | /* Disable tx laser; allow 100us to go dark per spec */ | 481 | ixgbe_disable_tx_laser_multispeed_fiber(hw); |
| 438 | esdp_reg |= IXGBE_ESDP_SDP3; | 482 | ixgbe_enable_tx_laser_multispeed_fiber(hw); |
| 439 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | ||
| 440 | IXGBE_WRITE_FLUSH(hw); | ||
| 441 | udelay(100); | ||
| 442 | |||
| 443 | /* Enable tx laser; allow 100ms to light up */ | ||
| 444 | esdp_reg &= ~IXGBE_ESDP_SDP3; | ||
| 445 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | ||
| 446 | IXGBE_WRITE_FLUSH(hw); | ||
| 447 | msleep(100); | ||
| 448 | |||
| 449 | hw->mac.autotry_restart = false; | 483 | hw->mac.autotry_restart = false; |
| 450 | } | 484 | } |
| 451 | } | 485 | } |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 8f677cb86290..6c00ee493a3b 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
| @@ -2982,6 +2982,10 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
| 2982 | else | 2982 | else |
| 2983 | ixgbe_configure_msi_and_legacy(adapter); | 2983 | ixgbe_configure_msi_and_legacy(adapter); |
| 2984 | 2984 | ||
| 2985 | /* enable the optics */ | ||
| 2986 | if (hw->phy.multispeed_fiber) | ||
| 2987 | hw->mac.ops.enable_tx_laser(hw); | ||
| 2988 | |||
| 2985 | clear_bit(__IXGBE_DOWN, &adapter->state); | 2989 | clear_bit(__IXGBE_DOWN, &adapter->state); |
| 2986 | ixgbe_napi_enable_all(adapter); | 2990 | ixgbe_napi_enable_all(adapter); |
| 2987 | 2991 | ||
| @@ -3243,6 +3247,10 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
| 3243 | /* signal that we are down to the interrupt handler */ | 3247 | /* signal that we are down to the interrupt handler */ |
| 3244 | set_bit(__IXGBE_DOWN, &adapter->state); | 3248 | set_bit(__IXGBE_DOWN, &adapter->state); |
| 3245 | 3249 | ||
| 3250 | /* power down the optics */ | ||
| 3251 | if (hw->phy.multispeed_fiber) | ||
| 3252 | hw->mac.ops.disable_tx_laser(hw); | ||
| 3253 | |||
| 3246 | /* disable receive for all VFs and wait one second */ | 3254 | /* disable receive for all VFs and wait one second */ |
| 3247 | if (adapter->num_vfs) { | 3255 | if (adapter->num_vfs) { |
| 3248 | /* ping all the active vfs to let them know we are going down */ | 3256 | /* ping all the active vfs to let them know we are going down */ |
| @@ -6253,6 +6261,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
| 6253 | goto err_eeprom; | 6261 | goto err_eeprom; |
| 6254 | } | 6262 | } |
| 6255 | 6263 | ||
| 6264 | /* power down the optics */ | ||
| 6265 | if (hw->phy.multispeed_fiber) | ||
| 6266 | hw->mac.ops.disable_tx_laser(hw); | ||
| 6267 | |||
| 6256 | init_timer(&adapter->watchdog_timer); | 6268 | init_timer(&adapter->watchdog_timer); |
| 6257 | adapter->watchdog_timer.function = &ixgbe_watchdog; | 6269 | adapter->watchdog_timer.function = &ixgbe_watchdog; |
| 6258 | adapter->watchdog_timer.data = (unsigned long)adapter; | 6270 | adapter->watchdog_timer.data = (unsigned long)adapter; |
| @@ -6400,16 +6412,6 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
| 6400 | del_timer_sync(&adapter->sfp_timer); | 6412 | del_timer_sync(&adapter->sfp_timer); |
| 6401 | cancel_work_sync(&adapter->watchdog_task); | 6413 | cancel_work_sync(&adapter->watchdog_task); |
| 6402 | cancel_work_sync(&adapter->sfp_task); | 6414 | cancel_work_sync(&adapter->sfp_task); |
| 6403 | if (adapter->hw.phy.multispeed_fiber) { | ||
| 6404 | struct ixgbe_hw *hw = &adapter->hw; | ||
| 6405 | /* | ||
| 6406 | * Restart clause 37 autoneg, disable and re-enable | ||
| 6407 | * the tx laser, to clear & alert the link partner | ||
| 6408 | * that it needs to restart autotry | ||
| 6409 | */ | ||
| 6410 | hw->mac.autotry_restart = true; | ||
| 6411 | hw->mac.ops.flap_tx_laser(hw); | ||
| 6412 | } | ||
| 6413 | cancel_work_sync(&adapter->multispeed_fiber_task); | 6415 | cancel_work_sync(&adapter->multispeed_fiber_task); |
| 6414 | cancel_work_sync(&adapter->sfp_config_module_task); | 6416 | cancel_work_sync(&adapter->sfp_config_module_task); |
| 6415 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || | 6417 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 4ec6dc1a5b75..534affcc38ca 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
| @@ -2398,6 +2398,8 @@ struct ixgbe_mac_operations { | |||
| 2398 | s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); | 2398 | s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); |
| 2399 | 2399 | ||
| 2400 | /* Link */ | 2400 | /* Link */ |
| 2401 | void (*disable_tx_laser)(struct ixgbe_hw *); | ||
| 2402 | void (*enable_tx_laser)(struct ixgbe_hw *); | ||
| 2401 | void (*flap_tx_laser)(struct ixgbe_hw *); | 2403 | void (*flap_tx_laser)(struct ixgbe_hw *); |
| 2402 | s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool); | 2404 | s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool); |
| 2403 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); | 2405 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index fd9d6e34fda4..ccc553782a0d 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
| @@ -1804,23 +1804,30 @@ static void media_check(u_long arg) | |||
| 1804 | SMC_SELECT_BANK(1); | 1804 | SMC_SELECT_BANK(1); |
| 1805 | media |= (inw(ioaddr + CONFIG) & CFG_AUI_SELECT) ? 2 : 1; | 1805 | media |= (inw(ioaddr + CONFIG) & CFG_AUI_SELECT) ? 2 : 1; |
| 1806 | 1806 | ||
| 1807 | SMC_SELECT_BANK(saved_bank); | ||
| 1808 | spin_unlock_irqrestore(&smc->lock, flags); | ||
| 1809 | |||
| 1807 | /* Check for pending interrupt with watchdog flag set: with | 1810 | /* Check for pending interrupt with watchdog flag set: with |
| 1808 | this, we can limp along even if the interrupt is blocked */ | 1811 | this, we can limp along even if the interrupt is blocked */ |
| 1809 | if (smc->watchdog++ && ((i>>8) & i)) { | 1812 | if (smc->watchdog++ && ((i>>8) & i)) { |
| 1810 | if (!smc->fast_poll) | 1813 | if (!smc->fast_poll) |
| 1811 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); | 1814 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); |
| 1815 | local_irq_save(flags); | ||
| 1812 | smc_interrupt(dev->irq, dev); | 1816 | smc_interrupt(dev->irq, dev); |
| 1817 | local_irq_restore(flags); | ||
| 1813 | smc->fast_poll = HZ; | 1818 | smc->fast_poll = HZ; |
| 1814 | } | 1819 | } |
| 1815 | if (smc->fast_poll) { | 1820 | if (smc->fast_poll) { |
| 1816 | smc->fast_poll--; | 1821 | smc->fast_poll--; |
| 1817 | smc->media.expires = jiffies + HZ/100; | 1822 | smc->media.expires = jiffies + HZ/100; |
| 1818 | add_timer(&smc->media); | 1823 | add_timer(&smc->media); |
| 1819 | SMC_SELECT_BANK(saved_bank); | ||
| 1820 | spin_unlock_irqrestore(&smc->lock, flags); | ||
| 1821 | return; | 1824 | return; |
| 1822 | } | 1825 | } |
| 1823 | 1826 | ||
| 1827 | spin_lock_irqsave(&smc->lock, flags); | ||
| 1828 | |||
| 1829 | saved_bank = inw(ioaddr + BANK_SELECT); | ||
| 1830 | |||
| 1824 | if (smc->cfg & CFG_MII_SELECT) { | 1831 | if (smc->cfg & CFG_MII_SELECT) { |
| 1825 | if (smc->mii_if.phy_id < 0) | 1832 | if (smc->mii_if.phy_id < 0) |
| 1826 | goto reschedule; | 1833 | goto reschedule; |
| @@ -1978,15 +1985,16 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 1978 | unsigned int ioaddr = dev->base_addr; | 1985 | unsigned int ioaddr = dev->base_addr; |
| 1979 | u16 saved_bank = inw(ioaddr + BANK_SELECT); | 1986 | u16 saved_bank = inw(ioaddr + BANK_SELECT); |
| 1980 | int ret; | 1987 | int ret; |
| 1988 | unsigned long flags; | ||
| 1981 | 1989 | ||
| 1982 | spin_lock_irq(&smc->lock); | 1990 | spin_lock_irqsave(&smc->lock, flags); |
| 1983 | SMC_SELECT_BANK(3); | 1991 | SMC_SELECT_BANK(3); |
| 1984 | if (smc->cfg & CFG_MII_SELECT) | 1992 | if (smc->cfg & CFG_MII_SELECT) |
| 1985 | ret = mii_ethtool_gset(&smc->mii_if, ecmd); | 1993 | ret = mii_ethtool_gset(&smc->mii_if, ecmd); |
| 1986 | else | 1994 | else |
| 1987 | ret = smc_netdev_get_ecmd(dev, ecmd); | 1995 | ret = smc_netdev_get_ecmd(dev, ecmd); |
| 1988 | SMC_SELECT_BANK(saved_bank); | 1996 | SMC_SELECT_BANK(saved_bank); |
| 1989 | spin_unlock_irq(&smc->lock); | 1997 | spin_unlock_irqrestore(&smc->lock, flags); |
| 1990 | return ret; | 1998 | return ret; |
| 1991 | } | 1999 | } |
| 1992 | 2000 | ||
| @@ -1996,15 +2004,16 @@ static int smc_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 1996 | unsigned int ioaddr = dev->base_addr; | 2004 | unsigned int ioaddr = dev->base_addr; |
| 1997 | u16 saved_bank = inw(ioaddr + BANK_SELECT); | 2005 | u16 saved_bank = inw(ioaddr + BANK_SELECT); |
| 1998 | int ret; | 2006 | int ret; |
| 2007 | unsigned long flags; | ||
| 1999 | 2008 | ||
| 2000 | spin_lock_irq(&smc->lock); | 2009 | spin_lock_irqsave(&smc->lock, flags); |
| 2001 | SMC_SELECT_BANK(3); | 2010 | SMC_SELECT_BANK(3); |
| 2002 | if (smc->cfg & CFG_MII_SELECT) | 2011 | if (smc->cfg & CFG_MII_SELECT) |
| 2003 | ret = mii_ethtool_sset(&smc->mii_if, ecmd); | 2012 | ret = mii_ethtool_sset(&smc->mii_if, ecmd); |
| 2004 | else | 2013 | else |
| 2005 | ret = smc_netdev_set_ecmd(dev, ecmd); | 2014 | ret = smc_netdev_set_ecmd(dev, ecmd); |
| 2006 | SMC_SELECT_BANK(saved_bank); | 2015 | SMC_SELECT_BANK(saved_bank); |
| 2007 | spin_unlock_irq(&smc->lock); | 2016 | spin_unlock_irqrestore(&smc->lock, flags); |
| 2008 | return ret; | 2017 | return ret; |
| 2009 | } | 2018 | } |
| 2010 | 2019 | ||
| @@ -2014,12 +2023,13 @@ static u32 smc_get_link(struct net_device *dev) | |||
| 2014 | unsigned int ioaddr = dev->base_addr; | 2023 | unsigned int ioaddr = dev->base_addr; |
| 2015 | u16 saved_bank = inw(ioaddr + BANK_SELECT); | 2024 | u16 saved_bank = inw(ioaddr + BANK_SELECT); |
| 2016 | u32 ret; | 2025 | u32 ret; |
| 2026 | unsigned long flags; | ||
| 2017 | 2027 | ||
| 2018 | spin_lock_irq(&smc->lock); | 2028 | spin_lock_irqsave(&smc->lock, flags); |
| 2019 | SMC_SELECT_BANK(3); | 2029 | SMC_SELECT_BANK(3); |
| 2020 | ret = smc_link_ok(dev); | 2030 | ret = smc_link_ok(dev); |
| 2021 | SMC_SELECT_BANK(saved_bank); | 2031 | SMC_SELECT_BANK(saved_bank); |
| 2022 | spin_unlock_irq(&smc->lock); | 2032 | spin_unlock_irqrestore(&smc->lock, flags); |
| 2023 | return ret; | 2033 | return ret; |
| 2024 | } | 2034 | } |
| 2025 | 2035 | ||
| @@ -2056,16 +2066,17 @@ static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 2056 | int rc = 0; | 2066 | int rc = 0; |
| 2057 | u16 saved_bank; | 2067 | u16 saved_bank; |
| 2058 | unsigned int ioaddr = dev->base_addr; | 2068 | unsigned int ioaddr = dev->base_addr; |
| 2069 | unsigned long flags; | ||
| 2059 | 2070 | ||
| 2060 | if (!netif_running(dev)) | 2071 | if (!netif_running(dev)) |
| 2061 | return -EINVAL; | 2072 | return -EINVAL; |
| 2062 | 2073 | ||
| 2063 | spin_lock_irq(&smc->lock); | 2074 | spin_lock_irqsave(&smc->lock, flags); |
| 2064 | saved_bank = inw(ioaddr + BANK_SELECT); | 2075 | saved_bank = inw(ioaddr + BANK_SELECT); |
| 2065 | SMC_SELECT_BANK(3); | 2076 | SMC_SELECT_BANK(3); |
| 2066 | rc = generic_mii_ioctl(&smc->mii_if, mii, cmd, NULL); | 2077 | rc = generic_mii_ioctl(&smc->mii_if, mii, cmd, NULL); |
| 2067 | SMC_SELECT_BANK(saved_bank); | 2078 | SMC_SELECT_BANK(saved_bank); |
| 2068 | spin_unlock_irq(&smc->lock); | 2079 | spin_unlock_irqrestore(&smc->lock, flags); |
| 2069 | return rc; | 2080 | return rc; |
| 2070 | } | 2081 | } |
| 2071 | 2082 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index dbb1f5a1824c..4748c21eb72e 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -2759,6 +2759,7 @@ static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev, | |||
| 2759 | { | 2759 | { |
| 2760 | iounmap(ioaddr); | 2760 | iounmap(ioaddr); |
| 2761 | pci_release_regions(pdev); | 2761 | pci_release_regions(pdev); |
| 2762 | pci_clear_mwi(pdev); | ||
| 2762 | pci_disable_device(pdev); | 2763 | pci_disable_device(pdev); |
| 2763 | free_netdev(dev); | 2764 | free_netdev(dev); |
| 2764 | } | 2765 | } |
| @@ -2825,8 +2826,13 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr) | |||
| 2825 | spin_lock_irq(&tp->lock); | 2826 | spin_lock_irq(&tp->lock); |
| 2826 | 2827 | ||
| 2827 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 2828 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
| 2829 | |||
| 2828 | RTL_W32(MAC4, high); | 2830 | RTL_W32(MAC4, high); |
| 2831 | RTL_R32(MAC4); | ||
| 2832 | |||
| 2829 | RTL_W32(MAC0, low); | 2833 | RTL_W32(MAC0, low); |
| 2834 | RTL_R32(MAC0); | ||
| 2835 | |||
| 2830 | RTL_W8(Cfg9346, Cfg9346_Lock); | 2836 | RTL_W8(Cfg9346, Cfg9346_Lock); |
| 2831 | 2837 | ||
| 2832 | spin_unlock_irq(&tp->lock); | 2838 | spin_unlock_irq(&tp->lock); |
| @@ -3014,9 +3020,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3014 | goto err_out_free_dev_1; | 3020 | goto err_out_free_dev_1; |
| 3015 | } | 3021 | } |
| 3016 | 3022 | ||
| 3017 | rc = pci_set_mwi(pdev); | 3023 | if (pci_set_mwi(pdev) < 0) |
| 3018 | if (rc < 0) | 3024 | netif_info(tp, probe, dev, "Mem-Wr-Inval unavailable\n"); |
| 3019 | goto err_out_disable_2; | ||
| 3020 | 3025 | ||
| 3021 | /* make sure PCI base addr 1 is MMIO */ | 3026 | /* make sure PCI base addr 1 is MMIO */ |
| 3022 | if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { | 3027 | if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { |
| @@ -3024,7 +3029,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3024 | "region #%d not an MMIO resource, aborting\n", | 3029 | "region #%d not an MMIO resource, aborting\n", |
| 3025 | region); | 3030 | region); |
| 3026 | rc = -ENODEV; | 3031 | rc = -ENODEV; |
| 3027 | goto err_out_mwi_3; | 3032 | goto err_out_mwi_2; |
| 3028 | } | 3033 | } |
| 3029 | 3034 | ||
| 3030 | /* check for weird/broken PCI region reporting */ | 3035 | /* check for weird/broken PCI region reporting */ |
| @@ -3032,13 +3037,13 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3032 | netif_err(tp, probe, dev, | 3037 | netif_err(tp, probe, dev, |
| 3033 | "Invalid PCI region size(s), aborting\n"); | 3038 | "Invalid PCI region size(s), aborting\n"); |
| 3034 | rc = -ENODEV; | 3039 | rc = -ENODEV; |
| 3035 | goto err_out_mwi_3; | 3040 | goto err_out_mwi_2; |
| 3036 | } | 3041 | } |
| 3037 | 3042 | ||
| 3038 | rc = pci_request_regions(pdev, MODULENAME); | 3043 | rc = pci_request_regions(pdev, MODULENAME); |
| 3039 | if (rc < 0) { | 3044 | if (rc < 0) { |
| 3040 | netif_err(tp, probe, dev, "could not request regions\n"); | 3045 | netif_err(tp, probe, dev, "could not request regions\n"); |
| 3041 | goto err_out_mwi_3; | 3046 | goto err_out_mwi_2; |
| 3042 | } | 3047 | } |
| 3043 | 3048 | ||
| 3044 | tp->cp_cmd = PCIMulRW | RxChkSum; | 3049 | tp->cp_cmd = PCIMulRW | RxChkSum; |
| @@ -3051,7 +3056,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3051 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 3056 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
| 3052 | if (rc < 0) { | 3057 | if (rc < 0) { |
| 3053 | netif_err(tp, probe, dev, "DMA configuration failed\n"); | 3058 | netif_err(tp, probe, dev, "DMA configuration failed\n"); |
| 3054 | goto err_out_free_res_4; | 3059 | goto err_out_free_res_3; |
| 3055 | } | 3060 | } |
| 3056 | } | 3061 | } |
| 3057 | 3062 | ||
| @@ -3060,7 +3065,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3060 | if (!ioaddr) { | 3065 | if (!ioaddr) { |
| 3061 | netif_err(tp, probe, dev, "cannot remap MMIO, aborting\n"); | 3066 | netif_err(tp, probe, dev, "cannot remap MMIO, aborting\n"); |
| 3062 | rc = -EIO; | 3067 | rc = -EIO; |
| 3063 | goto err_out_free_res_4; | 3068 | goto err_out_free_res_3; |
| 3064 | } | 3069 | } |
| 3065 | 3070 | ||
| 3066 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 3071 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
| @@ -3102,7 +3107,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3102 | if (i == ARRAY_SIZE(rtl_chip_info)) { | 3107 | if (i == ARRAY_SIZE(rtl_chip_info)) { |
| 3103 | dev_err(&pdev->dev, | 3108 | dev_err(&pdev->dev, |
| 3104 | "driver bug, MAC version not found in rtl_chip_info\n"); | 3109 | "driver bug, MAC version not found in rtl_chip_info\n"); |
| 3105 | goto err_out_msi_5; | 3110 | goto err_out_msi_4; |
| 3106 | } | 3111 | } |
| 3107 | tp->chipset = i; | 3112 | tp->chipset = i; |
| 3108 | 3113 | ||
| @@ -3167,7 +3172,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3167 | 3172 | ||
| 3168 | rc = register_netdev(dev); | 3173 | rc = register_netdev(dev); |
| 3169 | if (rc < 0) | 3174 | if (rc < 0) |
| 3170 | goto err_out_msi_5; | 3175 | goto err_out_msi_4; |
| 3171 | 3176 | ||
| 3172 | pci_set_drvdata(pdev, dev); | 3177 | pci_set_drvdata(pdev, dev); |
| 3173 | 3178 | ||
| @@ -3190,14 +3195,13 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3190 | out: | 3195 | out: |
| 3191 | return rc; | 3196 | return rc; |
| 3192 | 3197 | ||
| 3193 | err_out_msi_5: | 3198 | err_out_msi_4: |
| 3194 | rtl_disable_msi(pdev, tp); | 3199 | rtl_disable_msi(pdev, tp); |
| 3195 | iounmap(ioaddr); | 3200 | iounmap(ioaddr); |
| 3196 | err_out_free_res_4: | 3201 | err_out_free_res_3: |
| 3197 | pci_release_regions(pdev); | 3202 | pci_release_regions(pdev); |
| 3198 | err_out_mwi_3: | 3203 | err_out_mwi_2: |
| 3199 | pci_clear_mwi(pdev); | 3204 | pci_clear_mwi(pdev); |
| 3200 | err_out_disable_2: | ||
| 3201 | pci_disable_device(pdev); | 3205 | pci_disable_device(pdev); |
| 3202 | err_out_free_dev_1: | 3206 | err_out_free_dev_1: |
| 3203 | free_netdev(dev); | 3207 | free_netdev(dev); |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 6486657c47b8..649a264d6a81 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
| @@ -1861,6 +1861,7 @@ out: | |||
| 1861 | } | 1861 | } |
| 1862 | 1862 | ||
| 1863 | if (disabled) { | 1863 | if (disabled) { |
| 1864 | dev_close(efx->net_dev); | ||
| 1864 | EFX_ERR(efx, "has been disabled\n"); | 1865 | EFX_ERR(efx, "has been disabled\n"); |
| 1865 | efx->state = STATE_DISABLED; | 1866 | efx->state = STATE_DISABLED; |
| 1866 | } else { | 1867 | } else { |
| @@ -1884,8 +1885,7 @@ static void efx_reset_work(struct work_struct *data) | |||
| 1884 | } | 1885 | } |
| 1885 | 1886 | ||
| 1886 | rtnl_lock(); | 1887 | rtnl_lock(); |
| 1887 | if (efx_reset(efx, efx->reset_pending)) | 1888 | (void)efx_reset(efx, efx->reset_pending); |
| 1888 | dev_close(efx->net_dev); | ||
| 1889 | rtnl_unlock(); | 1889 | rtnl_unlock(); |
| 1890 | } | 1890 | } |
| 1891 | 1891 | ||
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index d294d66fd600..08278e7302b3 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
| @@ -1320,7 +1320,9 @@ static int falcon_probe_nvconfig(struct efx_nic *efx) | |||
| 1320 | 1320 | ||
| 1321 | EFX_LOG(efx, "PHY is %d phy_id %d\n", efx->phy_type, efx->mdio.prtad); | 1321 | EFX_LOG(efx, "PHY is %d phy_id %d\n", efx->phy_type, efx->mdio.prtad); |
| 1322 | 1322 | ||
| 1323 | falcon_probe_board(efx, board_rev); | 1323 | rc = falcon_probe_board(efx, board_rev); |
| 1324 | if (rc) | ||
| 1325 | goto fail2; | ||
| 1324 | 1326 | ||
| 1325 | kfree(nvconfig); | 1327 | kfree(nvconfig); |
| 1326 | return 0; | 1328 | return 0; |
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c index 5712fddd72f2..c7a933a3292e 100644 --- a/drivers/net/sfc/falcon_boards.c +++ b/drivers/net/sfc/falcon_boards.c | |||
| @@ -728,15 +728,7 @@ static const struct falcon_board_type board_types[] = { | |||
| 728 | }, | 728 | }, |
| 729 | }; | 729 | }; |
| 730 | 730 | ||
| 731 | static const struct falcon_board_type falcon_dummy_board = { | 731 | int falcon_probe_board(struct efx_nic *efx, u16 revision_info) |
| 732 | .init = efx_port_dummy_op_int, | ||
| 733 | .init_phy = efx_port_dummy_op_void, | ||
| 734 | .fini = efx_port_dummy_op_void, | ||
| 735 | .set_id_led = efx_port_dummy_op_set_id_led, | ||
| 736 | .monitor = efx_port_dummy_op_int, | ||
| 737 | }; | ||
| 738 | |||
| 739 | void falcon_probe_board(struct efx_nic *efx, u16 revision_info) | ||
| 740 | { | 732 | { |
| 741 | struct falcon_board *board = falcon_board(efx); | 733 | struct falcon_board *board = falcon_board(efx); |
| 742 | u8 type_id = FALCON_BOARD_TYPE(revision_info); | 734 | u8 type_id = FALCON_BOARD_TYPE(revision_info); |
| @@ -754,8 +746,9 @@ void falcon_probe_board(struct efx_nic *efx, u16 revision_info) | |||
| 754 | (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC) | 746 | (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC) |
| 755 | ? board->type->ref_model : board->type->gen_type, | 747 | ? board->type->ref_model : board->type->gen_type, |
| 756 | 'A' + board->major, board->minor); | 748 | 'A' + board->major, board->minor); |
| 749 | return 0; | ||
| 757 | } else { | 750 | } else { |
| 758 | EFX_ERR(efx, "unknown board type %d\n", type_id); | 751 | EFX_ERR(efx, "unknown board type %d\n", type_id); |
| 759 | board->type = &falcon_dummy_board; | 752 | return -ENODEV; |
| 760 | } | 753 | } |
| 761 | } | 754 | } |
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h index 9351c0331a47..3166bafdfbef 100644 --- a/drivers/net/sfc/nic.h +++ b/drivers/net/sfc/nic.h | |||
| @@ -156,7 +156,7 @@ extern struct efx_nic_type siena_a0_nic_type; | |||
| 156 | ************************************************************************** | 156 | ************************************************************************** |
| 157 | */ | 157 | */ |
| 158 | 158 | ||
| 159 | extern void falcon_probe_board(struct efx_nic *efx, u16 revision_info); | 159 | extern int falcon_probe_board(struct efx_nic *efx, u16 revision_info); |
| 160 | 160 | ||
| 161 | /* TX data path */ | 161 | /* TX data path */ |
| 162 | extern int efx_nic_probe_tx(struct efx_tx_queue *tx_queue); | 162 | extern int efx_nic_probe_tx(struct efx_tx_queue *tx_queue); |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index 38dcc42c4f79..e0c46f59d1f8 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
| @@ -456,8 +456,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) | |||
| 456 | 456 | ||
| 457 | static void siena_update_nic_stats(struct efx_nic *efx) | 457 | static void siena_update_nic_stats(struct efx_nic *efx) |
| 458 | { | 458 | { |
| 459 | while (siena_try_update_nic_stats(efx) == -EAGAIN) | 459 | int retry; |
| 460 | cpu_relax(); | 460 | |
| 461 | /* If we're unlucky enough to read statistics wduring the DMA, wait | ||
| 462 | * up to 10ms for it to finish (typically takes <500us) */ | ||
| 463 | for (retry = 0; retry < 100; ++retry) { | ||
| 464 | if (siena_try_update_nic_stats(efx) == 0) | ||
| 465 | return; | ||
| 466 | udelay(100); | ||
| 467 | } | ||
| 468 | |||
| 469 | /* Use the old values instead */ | ||
| 461 | } | 470 | } |
| 462 | 471 | ||
| 463 | static void siena_start_nic_stats(struct efx_nic *efx) | 472 | static void siena_start_nic_stats(struct efx_nic *efx) |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 22cf1c446de3..ecc41cffb470 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
| @@ -8633,6 +8633,7 @@ static int tg3_test_msi(struct tg3 *tp) | |||
| 8633 | pci_disable_msi(tp->pdev); | 8633 | pci_disable_msi(tp->pdev); |
| 8634 | 8634 | ||
| 8635 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; | 8635 | tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; |
| 8636 | tp->napi[0].irq_vec = tp->pdev->irq; | ||
| 8636 | 8637 | ||
| 8637 | err = tg3_request_irq(tp, 0); | 8638 | err = tg3_request_irq(tp, 0); |
| 8638 | if (err) | 8639 | if (err) |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 63be4caec70e..5d58abc224f4 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
| @@ -397,4 +397,14 @@ config USB_IPHETH | |||
| 397 | 397 | ||
| 398 | For more information: http://giagio.com/wiki/moin.cgi/iPhoneEthernetDriver | 398 | For more information: http://giagio.com/wiki/moin.cgi/iPhoneEthernetDriver |
| 399 | 399 | ||
| 400 | config USB_SIERRA_NET | ||
| 401 | tristate "USB-to-WWAN Driver for Sierra Wireless modems" | ||
| 402 | depends on USB_USBNET | ||
| 403 | default y | ||
| 404 | help | ||
| 405 | Choose this option if you have a Sierra Wireless USB-to-WWAN device. | ||
| 406 | |||
| 407 | To compile this driver as a module, choose M here: the | ||
| 408 | module will be called sierra_net. | ||
| 409 | |||
| 400 | endmenu | 410 | endmenu |
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile index edb09c0ddf8e..b13a279663ba 100644 --- a/drivers/net/usb/Makefile +++ b/drivers/net/usb/Makefile | |||
| @@ -24,4 +24,5 @@ obj-$(CONFIG_USB_USBNET) += usbnet.o | |||
| 24 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o | 24 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o |
| 25 | obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o | 25 | obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o |
| 26 | obj-$(CONFIG_USB_IPHETH) += ipheth.o | 26 | obj-$(CONFIG_USB_IPHETH) += ipheth.o |
| 27 | obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o | ||
| 27 | 28 | ||
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index c8cdb7f30adc..3547cf13d219 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
| @@ -431,6 +431,7 @@ static const struct driver_info mbm_info = { | |||
| 431 | .bind = cdc_bind, | 431 | .bind = cdc_bind, |
| 432 | .unbind = usbnet_cdc_unbind, | 432 | .unbind = usbnet_cdc_unbind, |
| 433 | .status = cdc_status, | 433 | .status = cdc_status, |
| 434 | .manage_power = cdc_manage_power, | ||
| 434 | }; | 435 | }; |
| 435 | 436 | ||
| 436 | /*-------------------------------------------------------------------------*/ | 437 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index fd1033130a81..418825d26f90 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
| @@ -122,25 +122,25 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) | |||
| 122 | 122 | ||
| 123 | tx_urb = usb_alloc_urb(0, GFP_KERNEL); | 123 | tx_urb = usb_alloc_urb(0, GFP_KERNEL); |
| 124 | if (tx_urb == NULL) | 124 | if (tx_urb == NULL) |
| 125 | goto error; | 125 | goto error_nomem; |
| 126 | 126 | ||
| 127 | rx_urb = usb_alloc_urb(0, GFP_KERNEL); | 127 | rx_urb = usb_alloc_urb(0, GFP_KERNEL); |
| 128 | if (rx_urb == NULL) | 128 | if (rx_urb == NULL) |
| 129 | goto error; | 129 | goto free_tx_urb; |
| 130 | 130 | ||
| 131 | tx_buf = usb_buffer_alloc(iphone->udev, | 131 | tx_buf = usb_buffer_alloc(iphone->udev, |
| 132 | IPHETH_BUF_SIZE, | 132 | IPHETH_BUF_SIZE, |
| 133 | GFP_KERNEL, | 133 | GFP_KERNEL, |
| 134 | &tx_urb->transfer_dma); | 134 | &tx_urb->transfer_dma); |
| 135 | if (tx_buf == NULL) | 135 | if (tx_buf == NULL) |
| 136 | goto error; | 136 | goto free_rx_urb; |
| 137 | 137 | ||
| 138 | rx_buf = usb_buffer_alloc(iphone->udev, | 138 | rx_buf = usb_buffer_alloc(iphone->udev, |
| 139 | IPHETH_BUF_SIZE, | 139 | IPHETH_BUF_SIZE, |
| 140 | GFP_KERNEL, | 140 | GFP_KERNEL, |
| 141 | &rx_urb->transfer_dma); | 141 | &rx_urb->transfer_dma); |
| 142 | if (rx_buf == NULL) | 142 | if (rx_buf == NULL) |
| 143 | goto error; | 143 | goto free_tx_buf; |
| 144 | 144 | ||
| 145 | 145 | ||
| 146 | iphone->tx_urb = tx_urb; | 146 | iphone->tx_urb = tx_urb; |
| @@ -149,13 +149,14 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) | |||
| 149 | iphone->rx_buf = rx_buf; | 149 | iphone->rx_buf = rx_buf; |
| 150 | return 0; | 150 | return 0; |
| 151 | 151 | ||
| 152 | error: | 152 | free_tx_buf: |
| 153 | usb_buffer_free(iphone->udev, IPHETH_BUF_SIZE, rx_buf, | ||
| 154 | rx_urb->transfer_dma); | ||
| 155 | usb_buffer_free(iphone->udev, IPHETH_BUF_SIZE, tx_buf, | 153 | usb_buffer_free(iphone->udev, IPHETH_BUF_SIZE, tx_buf, |
| 156 | tx_urb->transfer_dma); | 154 | tx_urb->transfer_dma); |
| 155 | free_rx_urb: | ||
| 157 | usb_free_urb(rx_urb); | 156 | usb_free_urb(rx_urb); |
| 157 | free_tx_urb: | ||
| 158 | usb_free_urb(tx_urb); | 158 | usb_free_urb(tx_urb); |
| 159 | error_nomem: | ||
| 159 | return -ENOMEM; | 160 | return -ENOMEM; |
| 160 | } | 161 | } |
| 161 | 162 | ||
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 52671ea043a7..c4c334d9770f 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
| @@ -145,6 +145,7 @@ static struct usb_device_id usb_klsi_table[] = { | |||
| 145 | { USB_DEVICE(0x0707, 0x0100) }, /* SMC 2202USB */ | 145 | { USB_DEVICE(0x0707, 0x0100) }, /* SMC 2202USB */ |
| 146 | { USB_DEVICE(0x07aa, 0x0001) }, /* Correga K.K. */ | 146 | { USB_DEVICE(0x07aa, 0x0001) }, /* Correga K.K. */ |
| 147 | { USB_DEVICE(0x07b8, 0x4000) }, /* D-Link DU-E10 */ | 147 | { USB_DEVICE(0x07b8, 0x4000) }, /* D-Link DU-E10 */ |
| 148 | { USB_DEVICE(0x07c9, 0xb010) }, /* Allied Telesyn AT-USB10 USB Ethernet Adapter */ | ||
| 148 | { USB_DEVICE(0x0846, 0x1001) }, /* NetGear EA-101 */ | 149 | { USB_DEVICE(0x0846, 0x1001) }, /* NetGear EA-101 */ |
| 149 | { USB_DEVICE(0x0846, 0x1002) }, /* NetGear EA-101 */ | 150 | { USB_DEVICE(0x0846, 0x1002) }, /* NetGear EA-101 */ |
| 150 | { USB_DEVICE(0x085a, 0x0008) }, /* PortGear Ethernet Adapter */ | 151 | { USB_DEVICE(0x085a, 0x0008) }, /* PortGear Ethernet Adapter */ |
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c new file mode 100644 index 000000000000..a44f9e0ea098 --- /dev/null +++ b/drivers/net/usb/sierra_net.c | |||
| @@ -0,0 +1,1001 @@ | |||
| 1 | /* | ||
| 2 | * USB-to-WWAN Driver for Sierra Wireless modems | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008, 2009, 2010 Paxton Smith, Matthew Safar, Rory Filer | ||
| 5 | * <linux@sierrawireless.com> | ||
| 6 | * | ||
| 7 | * Portions of this based on the cdc_ether driver by David Brownell (2003-2005) | ||
| 8 | * and Ole Andre Vadla Ravnas (ActiveSync) (2006). | ||
| 9 | * | ||
| 10 | * IMPORTANT DISCLAIMER: This driver is not commercially supported by | ||
| 11 | * Sierra Wireless. Use at your own risk. | ||
| 12 | * | ||
| 13 | * This program is free software; you can redistribute it and/or modify | ||
| 14 | * it under the terms of the GNU General Public License as published by | ||
| 15 | * the Free Software Foundation; either version 2 of the License, or | ||
| 16 | * (at your option) any later version. | ||
| 17 | * | ||
| 18 | * This program is distributed in the hope that it will be useful, | ||
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 21 | * GNU General Public License for more details. | ||
| 22 | * | ||
| 23 | * You should have received a copy of the GNU General Public License | ||
| 24 | * along with this program; if not, write to the Free Software | ||
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 26 | */ | ||
| 27 | |||
| 28 | #define DRIVER_VERSION "v.2.0" | ||
| 29 | #define DRIVER_AUTHOR "Paxton Smith, Matthew Safar, Rory Filer" | ||
| 30 | #define DRIVER_DESC "USB-to-WWAN Driver for Sierra Wireless modems" | ||
| 31 | static const char driver_name[] = "sierra_net"; | ||
| 32 | |||
| 33 | /* if defined debug messages enabled */ | ||
| 34 | /*#define DEBUG*/ | ||
| 35 | |||
| 36 | #include <linux/module.h> | ||
| 37 | #include <linux/etherdevice.h> | ||
| 38 | #include <linux/ethtool.h> | ||
| 39 | #include <linux/mii.h> | ||
| 40 | #include <linux/sched.h> | ||
| 41 | #include <linux/timer.h> | ||
| 42 | #include <linux/usb.h> | ||
| 43 | #include <linux/usb/cdc.h> | ||
| 44 | #include <net/ip.h> | ||
| 45 | #include <net/udp.h> | ||
| 46 | #include <asm/unaligned.h> | ||
| 47 | #include <linux/usb/usbnet.h> | ||
| 48 | |||
| 49 | #define SWI_USB_REQUEST_GET_FW_ATTR 0x06 | ||
| 50 | #define SWI_GET_FW_ATTR_MASK 0x08 | ||
| 51 | |||
| 52 | /* atomic counter partially included in MAC address to make sure 2 devices | ||
| 53 | * do not end up with the same MAC - concept breaks in case of > 255 ifaces | ||
| 54 | */ | ||
| 55 | static atomic_t iface_counter = ATOMIC_INIT(0); | ||
| 56 | |||
| 57 | /* | ||
| 58 | * SYNC Timer Delay definition used to set the expiry time | ||
| 59 | */ | ||
| 60 | #define SIERRA_NET_SYNCDELAY (2*HZ) | ||
| 61 | |||
| 62 | /* Max. MTU supported. The modem buffers are limited to 1500 */ | ||
| 63 | #define SIERRA_NET_MAX_SUPPORTED_MTU 1500 | ||
| 64 | |||
| 65 | /* The SIERRA_NET_USBCTL_BUF_LEN defines a buffer size allocated for control | ||
| 66 | * message reception ... and thus the max. received packet. | ||
| 67 | * (May be the cause for parse_hip returning -EINVAL) | ||
| 68 | */ | ||
| 69 | #define SIERRA_NET_USBCTL_BUF_LEN 1024 | ||
| 70 | |||
| 71 | /* list of interface numbers - used for constructing interface lists */ | ||
| 72 | struct sierra_net_iface_info { | ||
| 73 | const u32 infolen; /* number of interface numbers on list */ | ||
| 74 | const u8 *ifaceinfo; /* pointer to the array holding the numbers */ | ||
| 75 | }; | ||
| 76 | |||
| 77 | struct sierra_net_info_data { | ||
| 78 | u16 rx_urb_size; | ||
| 79 | struct sierra_net_iface_info whitelist; | ||
| 80 | }; | ||
| 81 | |||
| 82 | /* Private data structure */ | ||
| 83 | struct sierra_net_data { | ||
| 84 | |||
| 85 | u8 ethr_hdr_tmpl[ETH_HLEN]; /* ethernet header template for rx'd pkts */ | ||
| 86 | |||
| 87 | u16 link_up; /* air link up or down */ | ||
| 88 | u8 tx_hdr_template[4]; /* part of HIP hdr for tx'd packets */ | ||
| 89 | |||
| 90 | u8 sync_msg[4]; /* SYNC message */ | ||
| 91 | u8 shdwn_msg[4]; /* Shutdown message */ | ||
| 92 | |||
| 93 | /* Backpointer to the container */ | ||
| 94 | struct usbnet *usbnet; | ||
| 95 | |||
| 96 | u8 ifnum; /* interface number */ | ||
| 97 | |||
| 98 | /* Bit masks, must be a power of 2 */ | ||
| 99 | #define SIERRA_NET_EVENT_RESP_AVAIL 0x01 | ||
| 100 | #define SIERRA_NET_TIMER_EXPIRY 0x02 | ||
| 101 | unsigned long kevent_flags; | ||
| 102 | struct work_struct sierra_net_kevent; | ||
| 103 | struct timer_list sync_timer; /* For retrying SYNC sequence */ | ||
| 104 | }; | ||
| 105 | |||
| 106 | struct param { | ||
| 107 | int is_present; | ||
| 108 | union { | ||
| 109 | void *ptr; | ||
| 110 | u32 dword; | ||
| 111 | u16 word; | ||
| 112 | u8 byte; | ||
| 113 | }; | ||
| 114 | }; | ||
| 115 | |||
| 116 | /* HIP message type */ | ||
| 117 | #define SIERRA_NET_HIP_EXTENDEDID 0x7F | ||
| 118 | #define SIERRA_NET_HIP_HSYNC_ID 0x60 /* Modem -> host */ | ||
| 119 | #define SIERRA_NET_HIP_RESTART_ID 0x62 /* Modem -> host */ | ||
| 120 | #define SIERRA_NET_HIP_MSYNC_ID 0x20 /* Host -> modem */ | ||
| 121 | #define SIERRA_NET_HIP_SHUTD_ID 0x26 /* Host -> modem */ | ||
| 122 | |||
| 123 | #define SIERRA_NET_HIP_EXT_IP_IN_ID 0x0202 | ||
| 124 | #define SIERRA_NET_HIP_EXT_IP_OUT_ID 0x0002 | ||
| 125 | |||
| 126 | /* 3G UMTS Link Sense Indication definitions */ | ||
| 127 | #define SIERRA_NET_HIP_LSI_UMTSID 0x78 | ||
| 128 | |||
| 129 | /* Reverse Channel Grant Indication HIP message */ | ||
| 130 | #define SIERRA_NET_HIP_RCGI 0x64 | ||
| 131 | |||
| 132 | /* LSI Protocol types */ | ||
| 133 | #define SIERRA_NET_PROTOCOL_UMTS 0x01 | ||
| 134 | /* LSI Coverage */ | ||
| 135 | #define SIERRA_NET_COVERAGE_NONE 0x00 | ||
| 136 | #define SIERRA_NET_COVERAGE_NOPACKET 0x01 | ||
| 137 | |||
| 138 | /* LSI Session */ | ||
| 139 | #define SIERRA_NET_SESSION_IDLE 0x00 | ||
| 140 | /* LSI Link types */ | ||
| 141 | #define SIERRA_NET_AS_LINK_TYPE_IPv4 0x00 | ||
| 142 | |||
| 143 | struct lsi_umts { | ||
| 144 | u8 protocol; | ||
| 145 | u8 unused1; | ||
| 146 | __be16 length; | ||
| 147 | /* eventually use a union for the rest - assume umts for now */ | ||
| 148 | u8 coverage; | ||
| 149 | u8 unused2[41]; | ||
| 150 | u8 session_state; | ||
| 151 | u8 unused3[33]; | ||
| 152 | u8 link_type; | ||
| 153 | u8 pdp_addr_len; /* NW-supplied PDP address len */ | ||
| 154 | u8 pdp_addr[16]; /* NW-supplied PDP address (bigendian)) */ | ||
| 155 | u8 unused4[23]; | ||
| 156 | u8 dns1_addr_len; /* NW-supplied 1st DNS address len (bigendian) */ | ||
| 157 | u8 dns1_addr[16]; /* NW-supplied 1st DNS address */ | ||
| 158 | u8 dns2_addr_len; /* NW-supplied 2nd DNS address len */ | ||
| 159 | u8 dns2_addr[16]; /* NW-supplied 2nd DNS address (bigendian)*/ | ||
| 160 | u8 wins1_addr_len; /* NW-supplied 1st Wins address len */ | ||
| 161 | u8 wins1_addr[16]; /* NW-supplied 1st Wins address (bigendian)*/ | ||
| 162 | u8 wins2_addr_len; /* NW-supplied 2nd Wins address len */ | ||
| 163 | u8 wins2_addr[16]; /* NW-supplied 2nd Wins address (bigendian) */ | ||
| 164 | u8 unused5[4]; | ||
| 165 | u8 gw_addr_len; /* NW-supplied GW address len */ | ||
| 166 | u8 gw_addr[16]; /* NW-supplied GW address (bigendian) */ | ||
| 167 | u8 reserved[8]; | ||
| 168 | } __attribute__ ((packed)); | ||
| 169 | |||
| 170 | #define SIERRA_NET_LSI_COMMON_LEN 4 | ||
| 171 | #define SIERRA_NET_LSI_UMTS_LEN (sizeof(struct lsi_umts)) | ||
| 172 | #define SIERRA_NET_LSI_UMTS_STATUS_LEN \ | ||
| 173 | (SIERRA_NET_LSI_UMTS_LEN - SIERRA_NET_LSI_COMMON_LEN) | ||
| 174 | |||
| 175 | /* Forward definitions */ | ||
| 176 | static void sierra_sync_timer(unsigned long syncdata); | ||
| 177 | static int sierra_net_change_mtu(struct net_device *net, int new_mtu); | ||
| 178 | |||
| 179 | /* Our own net device operations structure */ | ||
| 180 | static const struct net_device_ops sierra_net_device_ops = { | ||
| 181 | .ndo_open = usbnet_open, | ||
| 182 | .ndo_stop = usbnet_stop, | ||
| 183 | .ndo_start_xmit = usbnet_start_xmit, | ||
| 184 | .ndo_tx_timeout = usbnet_tx_timeout, | ||
| 185 | .ndo_change_mtu = sierra_net_change_mtu, | ||
| 186 | .ndo_set_mac_address = eth_mac_addr, | ||
| 187 | .ndo_validate_addr = eth_validate_addr, | ||
| 188 | }; | ||
| 189 | |||
| 190 | /* get private data associated with passed in usbnet device */ | ||
| 191 | static inline struct sierra_net_data *sierra_net_get_private(struct usbnet *dev) | ||
| 192 | { | ||
| 193 | return (struct sierra_net_data *)dev->data[0]; | ||
| 194 | } | ||
| 195 | |||
| 196 | /* set private data associated with passed in usbnet device */ | ||
| 197 | static inline void sierra_net_set_private(struct usbnet *dev, | ||
| 198 | struct sierra_net_data *priv) | ||
| 199 | { | ||
| 200 | dev->data[0] = (unsigned long)priv; | ||
| 201 | } | ||
| 202 | |||
| 203 | /* is packet IPv4 */ | ||
| 204 | static inline int is_ip(struct sk_buff *skb) | ||
| 205 | { | ||
| 206 | return (skb->protocol == cpu_to_be16(ETH_P_IP)); | ||
| 207 | } | ||
| 208 | |||
| 209 | /* | ||
| 210 | * check passed in packet and make sure that: | ||
| 211 | * - it is linear (no scatter/gather) | ||
| 212 | * - it is ethernet (mac_header properly set) | ||
| 213 | */ | ||
| 214 | static int check_ethip_packet(struct sk_buff *skb, struct usbnet *dev) | ||
| 215 | { | ||
| 216 | skb_reset_mac_header(skb); /* ethernet header */ | ||
| 217 | |||
| 218 | if (skb_is_nonlinear(skb)) { | ||
| 219 | netdev_err(dev->net, "Non linear buffer-dropping\n"); | ||
| 220 | return 0; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (!pskb_may_pull(skb, ETH_HLEN)) | ||
| 224 | return 0; | ||
| 225 | skb->protocol = eth_hdr(skb)->h_proto; | ||
| 226 | |||
| 227 | return 1; | ||
| 228 | } | ||
| 229 | |||
| 230 | static const u8 *save16bit(struct param *p, const u8 *datap) | ||
| 231 | { | ||
| 232 | p->is_present = 1; | ||
| 233 | p->word = get_unaligned_be16(datap); | ||
| 234 | return datap + sizeof(p->word); | ||
| 235 | } | ||
| 236 | |||
| 237 | static const u8 *save8bit(struct param *p, const u8 *datap) | ||
| 238 | { | ||
| 239 | p->is_present = 1; | ||
| 240 | p->byte = *datap; | ||
| 241 | return datap + sizeof(p->byte); | ||
| 242 | } | ||
| 243 | |||
| 244 | /*----------------------------------------------------------------------------* | ||
| 245 | * BEGIN HIP * | ||
| 246 | *----------------------------------------------------------------------------*/ | ||
| 247 | /* HIP header */ | ||
| 248 | #define SIERRA_NET_HIP_HDR_LEN 4 | ||
| 249 | /* Extended HIP header */ | ||
| 250 | #define SIERRA_NET_HIP_EXT_HDR_LEN 6 | ||
| 251 | |||
| 252 | struct hip_hdr { | ||
| 253 | int hdrlen; | ||
| 254 | struct param payload_len; | ||
| 255 | struct param msgid; | ||
| 256 | struct param msgspecific; | ||
| 257 | struct param extmsgid; | ||
| 258 | }; | ||
| 259 | |||
| 260 | static int parse_hip(const u8 *buf, const u32 buflen, struct hip_hdr *hh) | ||
| 261 | { | ||
| 262 | const u8 *curp = buf; | ||
| 263 | int padded; | ||
| 264 | |||
| 265 | if (buflen < SIERRA_NET_HIP_HDR_LEN) | ||
| 266 | return -EPROTO; | ||
| 267 | |||
| 268 | curp = save16bit(&hh->payload_len, curp); | ||
| 269 | curp = save8bit(&hh->msgid, curp); | ||
| 270 | curp = save8bit(&hh->msgspecific, curp); | ||
| 271 | |||
| 272 | padded = hh->msgid.byte & 0x80; | ||
| 273 | hh->msgid.byte &= 0x7F; /* 7 bits */ | ||
| 274 | |||
| 275 | hh->extmsgid.is_present = (hh->msgid.byte == SIERRA_NET_HIP_EXTENDEDID); | ||
| 276 | if (hh->extmsgid.is_present) { | ||
| 277 | if (buflen < SIERRA_NET_HIP_EXT_HDR_LEN) | ||
| 278 | return -EPROTO; | ||
| 279 | |||
| 280 | hh->payload_len.word &= 0x3FFF; /* 14 bits */ | ||
| 281 | |||
| 282 | curp = save16bit(&hh->extmsgid, curp); | ||
| 283 | hh->extmsgid.word &= 0x03FF; /* 10 bits */ | ||
| 284 | |||
| 285 | hh->hdrlen = SIERRA_NET_HIP_EXT_HDR_LEN; | ||
| 286 | } else { | ||
| 287 | hh->payload_len.word &= 0x07FF; /* 11 bits */ | ||
| 288 | hh->hdrlen = SIERRA_NET_HIP_HDR_LEN; | ||
| 289 | } | ||
| 290 | |||
| 291 | if (padded) { | ||
| 292 | hh->hdrlen++; | ||
| 293 | hh->payload_len.word--; | ||
| 294 | } | ||
| 295 | |||
| 296 | /* if real packet shorter than the claimed length */ | ||
| 297 | if (buflen < (hh->hdrlen + hh->payload_len.word)) | ||
| 298 | return -EINVAL; | ||
| 299 | |||
| 300 | return 0; | ||
| 301 | } | ||
| 302 | |||
| 303 | static void build_hip(u8 *buf, const u16 payloadlen, | ||
| 304 | struct sierra_net_data *priv) | ||
| 305 | { | ||
| 306 | /* the following doesn't have the full functionality. We | ||
| 307 | * currently build only one kind of header, so it is faster this way | ||
| 308 | */ | ||
| 309 | put_unaligned_be16(payloadlen, buf); | ||
| 310 | memcpy(buf+2, priv->tx_hdr_template, sizeof(priv->tx_hdr_template)); | ||
| 311 | } | ||
| 312 | /*----------------------------------------------------------------------------* | ||
| 313 | * END HIP * | ||
| 314 | *----------------------------------------------------------------------------*/ | ||
| 315 | |||
| 316 | static int sierra_net_send_cmd(struct usbnet *dev, | ||
| 317 | u8 *cmd, int cmdlen, const char * cmd_name) | ||
| 318 | { | ||
| 319 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 320 | int status; | ||
| 321 | |||
| 322 | status = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | ||
| 323 | USB_CDC_SEND_ENCAPSULATED_COMMAND, | ||
| 324 | USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE, 0, | ||
| 325 | priv->ifnum, cmd, cmdlen, USB_CTRL_SET_TIMEOUT); | ||
| 326 | |||
| 327 | if (status != cmdlen && status != -ENODEV) | ||
| 328 | netdev_err(dev->net, "Submit %s failed %d\n", cmd_name, status); | ||
| 329 | |||
| 330 | return status; | ||
| 331 | } | ||
| 332 | |||
| 333 | static int sierra_net_send_sync(struct usbnet *dev) | ||
| 334 | { | ||
| 335 | int status; | ||
| 336 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 337 | |||
| 338 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 339 | |||
| 340 | status = sierra_net_send_cmd(dev, priv->sync_msg, | ||
| 341 | sizeof(priv->sync_msg), "SYNC"); | ||
| 342 | |||
| 343 | return status; | ||
| 344 | } | ||
| 345 | |||
| 346 | static void sierra_net_set_ctx_index(struct sierra_net_data *priv, u8 ctx_ix) | ||
| 347 | { | ||
| 348 | dev_dbg(&(priv->usbnet->udev->dev), "%s %d", __func__, ctx_ix); | ||
| 349 | priv->tx_hdr_template[0] = 0x3F; | ||
| 350 | priv->tx_hdr_template[1] = ctx_ix; | ||
| 351 | *((u16 *)&priv->tx_hdr_template[2]) = | ||
| 352 | cpu_to_be16(SIERRA_NET_HIP_EXT_IP_OUT_ID); | ||
| 353 | } | ||
| 354 | |||
| 355 | static inline int sierra_net_is_valid_addrlen(u8 len) | ||
| 356 | { | ||
| 357 | return (len == sizeof(struct in_addr)); | ||
| 358 | } | ||
| 359 | |||
| 360 | static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen) | ||
| 361 | { | ||
| 362 | struct lsi_umts *lsi = (struct lsi_umts *)data; | ||
| 363 | |||
| 364 | if (datalen < sizeof(struct lsi_umts)) { | ||
| 365 | netdev_err(dev->net, "%s: Data length %d, exp %Zu\n", | ||
| 366 | __func__, datalen, | ||
| 367 | sizeof(struct lsi_umts)); | ||
| 368 | return -1; | ||
| 369 | } | ||
| 370 | |||
| 371 | if (lsi->length != cpu_to_be16(SIERRA_NET_LSI_UMTS_STATUS_LEN)) { | ||
| 372 | netdev_err(dev->net, "%s: LSI_UMTS_STATUS_LEN %d, exp %u\n", | ||
| 373 | __func__, be16_to_cpu(lsi->length), | ||
| 374 | (u32)SIERRA_NET_LSI_UMTS_STATUS_LEN); | ||
| 375 | return -1; | ||
| 376 | } | ||
| 377 | |||
| 378 | /* Validate the protocol - only support UMTS for now */ | ||
| 379 | if (lsi->protocol != SIERRA_NET_PROTOCOL_UMTS) { | ||
| 380 | netdev_err(dev->net, "Protocol unsupported, 0x%02x\n", | ||
| 381 | lsi->protocol); | ||
| 382 | return -1; | ||
| 383 | } | ||
| 384 | |||
| 385 | /* Validate the link type */ | ||
| 386 | if (lsi->link_type != SIERRA_NET_AS_LINK_TYPE_IPv4) { | ||
| 387 | netdev_err(dev->net, "Link type unsupported: 0x%02x\n", | ||
| 388 | lsi->link_type); | ||
| 389 | return -1; | ||
| 390 | } | ||
| 391 | |||
| 392 | /* Validate the coverage */ | ||
| 393 | if (lsi->coverage == SIERRA_NET_COVERAGE_NONE | ||
| 394 | || lsi->coverage == SIERRA_NET_COVERAGE_NOPACKET) { | ||
| 395 | netdev_err(dev->net, "No coverage, 0x%02x\n", lsi->coverage); | ||
| 396 | return 0; | ||
| 397 | } | ||
| 398 | |||
| 399 | /* Validate the session state */ | ||
| 400 | if (lsi->session_state == SIERRA_NET_SESSION_IDLE) { | ||
| 401 | netdev_err(dev->net, "Session idle, 0x%02x\n", | ||
| 402 | lsi->session_state); | ||
| 403 | return 0; | ||
| 404 | } | ||
| 405 | |||
| 406 | /* Set link_sense true */ | ||
| 407 | return 1; | ||
| 408 | } | ||
| 409 | |||
| 410 | static void sierra_net_handle_lsi(struct usbnet *dev, char *data, | ||
| 411 | struct hip_hdr *hh) | ||
| 412 | { | ||
| 413 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 414 | int link_up; | ||
| 415 | |||
| 416 | link_up = sierra_net_parse_lsi(dev, data + hh->hdrlen, | ||
| 417 | hh->payload_len.word); | ||
| 418 | if (link_up < 0) { | ||
| 419 | netdev_err(dev->net, "Invalid LSI\n"); | ||
| 420 | return; | ||
| 421 | } | ||
| 422 | if (link_up) { | ||
| 423 | sierra_net_set_ctx_index(priv, hh->msgspecific.byte); | ||
| 424 | priv->link_up = 1; | ||
| 425 | netif_carrier_on(dev->net); | ||
| 426 | } else { | ||
| 427 | priv->link_up = 0; | ||
| 428 | netif_carrier_off(dev->net); | ||
| 429 | } | ||
| 430 | } | ||
| 431 | |||
| 432 | static void sierra_net_dosync(struct usbnet *dev) | ||
| 433 | { | ||
| 434 | int status; | ||
| 435 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 436 | |||
| 437 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 438 | |||
| 439 | /* tell modem we are ready */ | ||
| 440 | status = sierra_net_send_sync(dev); | ||
| 441 | if (status < 0) | ||
| 442 | netdev_err(dev->net, | ||
| 443 | "Send SYNC failed, status %d\n", status); | ||
| 444 | status = sierra_net_send_sync(dev); | ||
| 445 | if (status < 0) | ||
| 446 | netdev_err(dev->net, | ||
| 447 | "Send SYNC failed, status %d\n", status); | ||
| 448 | |||
| 449 | /* Now, start a timer and make sure we get the Restart Indication */ | ||
| 450 | priv->sync_timer.function = sierra_sync_timer; | ||
| 451 | priv->sync_timer.data = (unsigned long) dev; | ||
| 452 | priv->sync_timer.expires = jiffies + SIERRA_NET_SYNCDELAY; | ||
| 453 | add_timer(&priv->sync_timer); | ||
| 454 | } | ||
| 455 | |||
| 456 | static void sierra_net_kevent(struct work_struct *work) | ||
| 457 | { | ||
| 458 | struct sierra_net_data *priv = | ||
| 459 | container_of(work, struct sierra_net_data, sierra_net_kevent); | ||
| 460 | struct usbnet *dev = priv->usbnet; | ||
| 461 | int len; | ||
| 462 | int err; | ||
| 463 | u8 *buf; | ||
| 464 | u8 ifnum; | ||
| 465 | |||
| 466 | if (test_bit(SIERRA_NET_EVENT_RESP_AVAIL, &priv->kevent_flags)) { | ||
| 467 | clear_bit(SIERRA_NET_EVENT_RESP_AVAIL, &priv->kevent_flags); | ||
| 468 | |||
| 469 | /* Query the modem for the LSI message */ | ||
| 470 | buf = kzalloc(SIERRA_NET_USBCTL_BUF_LEN, GFP_KERNEL); | ||
| 471 | if (!buf) { | ||
| 472 | netdev_err(dev->net, | ||
| 473 | "failed to allocate buf for LS msg\n"); | ||
| 474 | return; | ||
| 475 | } | ||
| 476 | ifnum = priv->ifnum; | ||
| 477 | len = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), | ||
| 478 | USB_CDC_GET_ENCAPSULATED_RESPONSE, | ||
| 479 | USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE, | ||
| 480 | 0, ifnum, buf, SIERRA_NET_USBCTL_BUF_LEN, | ||
| 481 | USB_CTRL_SET_TIMEOUT); | ||
| 482 | |||
| 483 | if (len < 0) { | ||
| 484 | netdev_err(dev->net, | ||
| 485 | "usb_control_msg failed, status %d\n", len); | ||
| 486 | } else { | ||
| 487 | struct hip_hdr hh; | ||
| 488 | |||
| 489 | dev_dbg(&dev->udev->dev, "%s: Received status message," | ||
| 490 | " %04x bytes", __func__, len); | ||
| 491 | |||
| 492 | err = parse_hip(buf, len, &hh); | ||
| 493 | if (err) { | ||
| 494 | netdev_err(dev->net, "%s: Bad packet," | ||
| 495 | " parse result %d\n", __func__, err); | ||
| 496 | kfree(buf); | ||
| 497 | return; | ||
| 498 | } | ||
| 499 | |||
| 500 | /* Validate packet length */ | ||
| 501 | if (len != hh.hdrlen + hh.payload_len.word) { | ||
| 502 | netdev_err(dev->net, "%s: Bad packet, received" | ||
| 503 | " %d, expected %d\n", __func__, len, | ||
| 504 | hh.hdrlen + hh.payload_len.word); | ||
| 505 | kfree(buf); | ||
| 506 | return; | ||
| 507 | } | ||
| 508 | |||
| 509 | /* Switch on received message types */ | ||
| 510 | switch (hh.msgid.byte) { | ||
| 511 | case SIERRA_NET_HIP_LSI_UMTSID: | ||
| 512 | dev_dbg(&dev->udev->dev, "LSI for ctx:%d", | ||
| 513 | hh.msgspecific.byte); | ||
| 514 | sierra_net_handle_lsi(dev, buf, &hh); | ||
| 515 | break; | ||
| 516 | case SIERRA_NET_HIP_RESTART_ID: | ||
| 517 | dev_dbg(&dev->udev->dev, "Restart reported: %d," | ||
| 518 | " stopping sync timer", | ||
| 519 | hh.msgspecific.byte); | ||
| 520 | /* Got sync resp - stop timer & clear mask */ | ||
| 521 | del_timer_sync(&priv->sync_timer); | ||
| 522 | clear_bit(SIERRA_NET_TIMER_EXPIRY, | ||
| 523 | &priv->kevent_flags); | ||
| 524 | break; | ||
| 525 | case SIERRA_NET_HIP_HSYNC_ID: | ||
| 526 | dev_dbg(&dev->udev->dev, "SYNC received"); | ||
| 527 | err = sierra_net_send_sync(dev); | ||
| 528 | if (err < 0) | ||
| 529 | netdev_err(dev->net, | ||
| 530 | "Send SYNC failed %d\n", err); | ||
| 531 | break; | ||
| 532 | case SIERRA_NET_HIP_EXTENDEDID: | ||
| 533 | netdev_err(dev->net, "Unrecognized HIP msg, " | ||
| 534 | "extmsgid 0x%04x\n", hh.extmsgid.word); | ||
| 535 | break; | ||
| 536 | case SIERRA_NET_HIP_RCGI: | ||
| 537 | /* Ignored */ | ||
| 538 | break; | ||
| 539 | default: | ||
| 540 | netdev_err(dev->net, "Unrecognized HIP msg, " | ||
| 541 | "msgid 0x%02x\n", hh.msgid.byte); | ||
| 542 | break; | ||
| 543 | } | ||
| 544 | } | ||
| 545 | kfree(buf); | ||
| 546 | } | ||
| 547 | /* The sync timer bit might be set */ | ||
| 548 | if (test_bit(SIERRA_NET_TIMER_EXPIRY, &priv->kevent_flags)) { | ||
| 549 | clear_bit(SIERRA_NET_TIMER_EXPIRY, &priv->kevent_flags); | ||
| 550 | dev_dbg(&dev->udev->dev, "Deferred sync timer expiry"); | ||
| 551 | sierra_net_dosync(priv->usbnet); | ||
| 552 | } | ||
| 553 | |||
| 554 | if (priv->kevent_flags) | ||
| 555 | dev_dbg(&dev->udev->dev, "sierra_net_kevent done, " | ||
| 556 | "kevent_flags = 0x%lx", priv->kevent_flags); | ||
| 557 | } | ||
| 558 | |||
| 559 | static void sierra_net_defer_kevent(struct usbnet *dev, int work) | ||
| 560 | { | ||
| 561 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 562 | |||
| 563 | set_bit(work, &priv->kevent_flags); | ||
| 564 | schedule_work(&priv->sierra_net_kevent); | ||
| 565 | } | ||
| 566 | |||
| 567 | /* | ||
| 568 | * Sync Retransmit Timer Handler. On expiry, kick the work queue | ||
| 569 | */ | ||
| 570 | void sierra_sync_timer(unsigned long syncdata) | ||
| 571 | { | ||
| 572 | struct usbnet *dev = (struct usbnet *)syncdata; | ||
| 573 | |||
| 574 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 575 | /* Kick the tasklet */ | ||
| 576 | sierra_net_defer_kevent(dev, SIERRA_NET_TIMER_EXPIRY); | ||
| 577 | } | ||
| 578 | |||
| 579 | static void sierra_net_status(struct usbnet *dev, struct urb *urb) | ||
| 580 | { | ||
| 581 | struct usb_cdc_notification *event; | ||
| 582 | |||
| 583 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 584 | |||
| 585 | if (urb->actual_length < sizeof *event) | ||
| 586 | return; | ||
| 587 | |||
| 588 | /* Add cases to handle other standard notifications. */ | ||
| 589 | event = urb->transfer_buffer; | ||
| 590 | switch (event->bNotificationType) { | ||
| 591 | case USB_CDC_NOTIFY_NETWORK_CONNECTION: | ||
| 592 | case USB_CDC_NOTIFY_SPEED_CHANGE: | ||
| 593 | /* USB 305 sends those */ | ||
| 594 | break; | ||
| 595 | case USB_CDC_NOTIFY_RESPONSE_AVAILABLE: | ||
| 596 | sierra_net_defer_kevent(dev, SIERRA_NET_EVENT_RESP_AVAIL); | ||
| 597 | break; | ||
| 598 | default: | ||
| 599 | netdev_err(dev->net, ": unexpected notification %02x!\n", | ||
| 600 | event->bNotificationType); | ||
| 601 | break; | ||
| 602 | } | ||
| 603 | } | ||
| 604 | |||
| 605 | static void sierra_net_get_drvinfo(struct net_device *net, | ||
| 606 | struct ethtool_drvinfo *info) | ||
| 607 | { | ||
| 608 | /* Inherit standard device info */ | ||
| 609 | usbnet_get_drvinfo(net, info); | ||
| 610 | strncpy(info->driver, driver_name, sizeof info->driver); | ||
| 611 | strncpy(info->version, DRIVER_VERSION, sizeof info->version); | ||
| 612 | } | ||
| 613 | |||
| 614 | static u32 sierra_net_get_link(struct net_device *net) | ||
| 615 | { | ||
| 616 | struct usbnet *dev = netdev_priv(net); | ||
| 617 | /* Report link is down whenever the interface is down */ | ||
| 618 | return sierra_net_get_private(dev)->link_up && netif_running(net); | ||
| 619 | } | ||
| 620 | |||
| 621 | static struct ethtool_ops sierra_net_ethtool_ops = { | ||
| 622 | .get_drvinfo = sierra_net_get_drvinfo, | ||
| 623 | .get_link = sierra_net_get_link, | ||
| 624 | .get_msglevel = usbnet_get_msglevel, | ||
| 625 | .set_msglevel = usbnet_set_msglevel, | ||
| 626 | .get_settings = usbnet_get_settings, | ||
| 627 | .set_settings = usbnet_set_settings, | ||
| 628 | .nway_reset = usbnet_nway_reset, | ||
| 629 | }; | ||
| 630 | |||
| 631 | /* MTU can not be more than 1500 bytes, enforce it. */ | ||
| 632 | static int sierra_net_change_mtu(struct net_device *net, int new_mtu) | ||
| 633 | { | ||
| 634 | if (new_mtu > SIERRA_NET_MAX_SUPPORTED_MTU) | ||
| 635 | return -EINVAL; | ||
| 636 | |||
| 637 | return usbnet_change_mtu(net, new_mtu); | ||
| 638 | } | ||
| 639 | |||
| 640 | static int is_whitelisted(const u8 ifnum, | ||
| 641 | const struct sierra_net_iface_info *whitelist) | ||
| 642 | { | ||
| 643 | if (whitelist) { | ||
| 644 | const u8 *list = whitelist->ifaceinfo; | ||
| 645 | int i; | ||
| 646 | |||
| 647 | for (i = 0; i < whitelist->infolen; i++) { | ||
| 648 | if (list[i] == ifnum) | ||
| 649 | return 1; | ||
| 650 | } | ||
| 651 | } | ||
| 652 | return 0; | ||
| 653 | } | ||
| 654 | |||
| 655 | static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap) | ||
| 656 | { | ||
| 657 | int result = 0; | ||
| 658 | u16 *attrdata; | ||
| 659 | |||
| 660 | attrdata = kmalloc(sizeof(*attrdata), GFP_KERNEL); | ||
| 661 | if (!attrdata) | ||
| 662 | return -ENOMEM; | ||
| 663 | |||
| 664 | result = usb_control_msg( | ||
| 665 | dev->udev, | ||
| 666 | usb_rcvctrlpipe(dev->udev, 0), | ||
| 667 | /* _u8 vendor specific request */ | ||
| 668 | SWI_USB_REQUEST_GET_FW_ATTR, | ||
| 669 | USB_DIR_IN | USB_TYPE_VENDOR, /* __u8 request type */ | ||
| 670 | 0x0000, /* __u16 value not used */ | ||
| 671 | 0x0000, /* __u16 index not used */ | ||
| 672 | attrdata, /* char *data */ | ||
| 673 | sizeof(*attrdata), /* __u16 size */ | ||
| 674 | USB_CTRL_SET_TIMEOUT); /* int timeout */ | ||
| 675 | |||
| 676 | if (result < 0) { | ||
| 677 | kfree(attrdata); | ||
| 678 | return -EIO; | ||
| 679 | } | ||
| 680 | |||
| 681 | *datap = *attrdata; | ||
| 682 | |||
| 683 | kfree(attrdata); | ||
| 684 | return result; | ||
| 685 | } | ||
| 686 | |||
| 687 | /* | ||
| 688 | * collects the bulk endpoints, the status endpoint. | ||
| 689 | */ | ||
| 690 | static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf) | ||
| 691 | { | ||
| 692 | u8 ifacenum; | ||
| 693 | u8 numendpoints; | ||
| 694 | u16 fwattr = 0; | ||
| 695 | int status; | ||
| 696 | struct ethhdr *eth; | ||
| 697 | struct sierra_net_data *priv; | ||
| 698 | static const u8 sync_tmplate[sizeof(priv->sync_msg)] = { | ||
| 699 | 0x00, 0x00, SIERRA_NET_HIP_MSYNC_ID, 0x00}; | ||
| 700 | static const u8 shdwn_tmplate[sizeof(priv->shdwn_msg)] = { | ||
| 701 | 0x00, 0x00, SIERRA_NET_HIP_SHUTD_ID, 0x00}; | ||
| 702 | |||
| 703 | struct sierra_net_info_data *data = | ||
| 704 | (struct sierra_net_info_data *)dev->driver_info->data; | ||
| 705 | |||
| 706 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 707 | |||
| 708 | ifacenum = intf->cur_altsetting->desc.bInterfaceNumber; | ||
| 709 | /* We only accept certain interfaces */ | ||
| 710 | if (!is_whitelisted(ifacenum, &data->whitelist)) { | ||
| 711 | dev_dbg(&dev->udev->dev, "Ignoring interface: %d", ifacenum); | ||
| 712 | return -ENODEV; | ||
| 713 | } | ||
| 714 | numendpoints = intf->cur_altsetting->desc.bNumEndpoints; | ||
| 715 | /* We have three endpoints, bulk in and out, and a status */ | ||
| 716 | if (numendpoints != 3) { | ||
| 717 | dev_err(&dev->udev->dev, "Expected 3 endpoints, found: %d", | ||
| 718 | numendpoints); | ||
| 719 | return -ENODEV; | ||
| 720 | } | ||
| 721 | /* Status endpoint set in usbnet_get_endpoints() */ | ||
| 722 | dev->status = NULL; | ||
| 723 | status = usbnet_get_endpoints(dev, intf); | ||
| 724 | if (status < 0) { | ||
| 725 | dev_err(&dev->udev->dev, "Error in usbnet_get_endpoints (%d)", | ||
| 726 | status); | ||
| 727 | return -ENODEV; | ||
| 728 | } | ||
| 729 | /* Initialize sierra private data */ | ||
| 730 | priv = kzalloc(sizeof *priv, GFP_KERNEL); | ||
| 731 | if (!priv) { | ||
| 732 | dev_err(&dev->udev->dev, "No memory"); | ||
| 733 | return -ENOMEM; | ||
| 734 | } | ||
| 735 | |||
| 736 | priv->usbnet = dev; | ||
| 737 | priv->ifnum = ifacenum; | ||
| 738 | dev->net->netdev_ops = &sierra_net_device_ops; | ||
| 739 | |||
| 740 | /* change MAC addr to include, ifacenum, and to be unique */ | ||
| 741 | dev->net->dev_addr[ETH_ALEN-2] = atomic_inc_return(&iface_counter); | ||
| 742 | dev->net->dev_addr[ETH_ALEN-1] = ifacenum; | ||
| 743 | |||
| 744 | /* we will have to manufacture ethernet headers, prepare template */ | ||
| 745 | eth = (struct ethhdr *)priv->ethr_hdr_tmpl; | ||
| 746 | memcpy(ð->h_dest, dev->net->dev_addr, ETH_ALEN); | ||
| 747 | eth->h_proto = cpu_to_be16(ETH_P_IP); | ||
| 748 | |||
| 749 | /* prepare shutdown message template */ | ||
| 750 | memcpy(priv->shdwn_msg, shdwn_tmplate, sizeof(priv->shdwn_msg)); | ||
| 751 | /* set context index initially to 0 - prepares tx hdr template */ | ||
| 752 | sierra_net_set_ctx_index(priv, 0); | ||
| 753 | |||
| 754 | /* decrease the rx_urb_size and max_tx_size to 4k on USB 1.1 */ | ||
| 755 | dev->rx_urb_size = data->rx_urb_size; | ||
| 756 | if (dev->udev->speed != USB_SPEED_HIGH) | ||
| 757 | dev->rx_urb_size = min_t(size_t, 4096, data->rx_urb_size); | ||
| 758 | |||
| 759 | dev->net->hard_header_len += SIERRA_NET_HIP_EXT_HDR_LEN; | ||
| 760 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
| 761 | |||
| 762 | /* Set up the netdev */ | ||
| 763 | dev->net->flags |= IFF_NOARP; | ||
| 764 | dev->net->ethtool_ops = &sierra_net_ethtool_ops; | ||
| 765 | netif_carrier_off(dev->net); | ||
| 766 | |||
| 767 | sierra_net_set_private(dev, priv); | ||
| 768 | |||
| 769 | priv->kevent_flags = 0; | ||
| 770 | |||
| 771 | /* Use the shared workqueue */ | ||
| 772 | INIT_WORK(&priv->sierra_net_kevent, sierra_net_kevent); | ||
| 773 | |||
| 774 | /* Only need to do this once */ | ||
| 775 | init_timer(&priv->sync_timer); | ||
| 776 | |||
| 777 | /* verify fw attributes */ | ||
| 778 | status = sierra_net_get_fw_attr(dev, &fwattr); | ||
| 779 | dev_dbg(&dev->udev->dev, "Fw attr: %x\n", fwattr); | ||
| 780 | |||
| 781 | /* test whether firmware supports DHCP */ | ||
| 782 | if (!(status == sizeof(fwattr) && (fwattr & SWI_GET_FW_ATTR_MASK))) { | ||
| 783 | /* found incompatible firmware version */ | ||
| 784 | dev_err(&dev->udev->dev, "Incompatible driver and firmware" | ||
| 785 | " versions\n"); | ||
| 786 | kfree(priv); | ||
| 787 | return -ENODEV; | ||
| 788 | } | ||
| 789 | /* prepare sync message from template */ | ||
| 790 | memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg)); | ||
| 791 | |||
| 792 | return 0; | ||
| 793 | } | ||
| 794 | |||
| 795 | static void sierra_net_unbind(struct usbnet *dev, struct usb_interface *intf) | ||
| 796 | { | ||
| 797 | int status; | ||
| 798 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 799 | |||
| 800 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 801 | |||
| 802 | /* Kill the timer then flush the work queue */ | ||
| 803 | del_timer_sync(&priv->sync_timer); | ||
| 804 | |||
| 805 | flush_scheduled_work(); | ||
| 806 | |||
| 807 | /* tell modem we are going away */ | ||
| 808 | status = sierra_net_send_cmd(dev, priv->shdwn_msg, | ||
| 809 | sizeof(priv->shdwn_msg), "Shutdown"); | ||
| 810 | if (status < 0) | ||
| 811 | netdev_err(dev->net, | ||
| 812 | "usb_control_msg failed, status %d\n", status); | ||
| 813 | |||
| 814 | sierra_net_set_private(dev, NULL); | ||
| 815 | |||
| 816 | kfree(priv); | ||
| 817 | } | ||
| 818 | |||
| 819 | static struct sk_buff *sierra_net_skb_clone(struct usbnet *dev, | ||
| 820 | struct sk_buff *skb, int len) | ||
| 821 | { | ||
| 822 | struct sk_buff *new_skb; | ||
| 823 | |||
| 824 | /* clone skb */ | ||
| 825 | new_skb = skb_clone(skb, GFP_ATOMIC); | ||
| 826 | |||
| 827 | /* remove len bytes from original */ | ||
| 828 | skb_pull(skb, len); | ||
| 829 | |||
| 830 | /* trim next packet to it's length */ | ||
| 831 | if (new_skb) { | ||
| 832 | skb_trim(new_skb, len); | ||
| 833 | } else { | ||
| 834 | if (netif_msg_rx_err(dev)) | ||
| 835 | netdev_err(dev->net, "failed to get skb\n"); | ||
| 836 | dev->net->stats.rx_dropped++; | ||
| 837 | } | ||
| 838 | |||
| 839 | return new_skb; | ||
| 840 | } | ||
| 841 | |||
| 842 | /* ---------------------------- Receive data path ----------------------*/ | ||
| 843 | static int sierra_net_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
| 844 | { | ||
| 845 | int err; | ||
| 846 | struct hip_hdr hh; | ||
| 847 | struct sk_buff *new_skb; | ||
| 848 | |||
| 849 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 850 | |||
| 851 | /* could contain multiple packets */ | ||
| 852 | while (likely(skb->len)) { | ||
| 853 | err = parse_hip(skb->data, skb->len, &hh); | ||
| 854 | if (err) { | ||
| 855 | if (netif_msg_rx_err(dev)) | ||
| 856 | netdev_err(dev->net, "Invalid HIP header %d\n", | ||
| 857 | err); | ||
| 858 | /* dev->net->stats.rx_errors incremented by caller */ | ||
| 859 | dev->net->stats.rx_length_errors++; | ||
| 860 | return 0; | ||
| 861 | } | ||
| 862 | |||
| 863 | /* Validate Extended HIP header */ | ||
| 864 | if (!hh.extmsgid.is_present | ||
| 865 | || hh.extmsgid.word != SIERRA_NET_HIP_EXT_IP_IN_ID) { | ||
| 866 | if (netif_msg_rx_err(dev)) | ||
| 867 | netdev_err(dev->net, "HIP/ETH: Invalid pkt\n"); | ||
| 868 | |||
| 869 | dev->net->stats.rx_frame_errors++; | ||
| 870 | /* dev->net->stats.rx_errors incremented by caller */; | ||
| 871 | return 0; | ||
| 872 | } | ||
| 873 | |||
| 874 | skb_pull(skb, hh.hdrlen); | ||
| 875 | |||
| 876 | /* We are going to accept this packet, prepare it */ | ||
| 877 | memcpy(skb->data, sierra_net_get_private(dev)->ethr_hdr_tmpl, | ||
| 878 | ETH_HLEN); | ||
| 879 | |||
| 880 | /* Last packet in batch handled by usbnet */ | ||
| 881 | if (hh.payload_len.word == skb->len) | ||
| 882 | return 1; | ||
| 883 | |||
| 884 | new_skb = sierra_net_skb_clone(dev, skb, hh.payload_len.word); | ||
| 885 | if (new_skb) | ||
| 886 | usbnet_skb_return(dev, new_skb); | ||
| 887 | |||
| 888 | } /* while */ | ||
| 889 | |||
| 890 | return 0; | ||
| 891 | } | ||
| 892 | |||
| 893 | /* ---------------------------- Transmit data path ----------------------*/ | ||
| 894 | struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | ||
| 895 | gfp_t flags) | ||
| 896 | { | ||
| 897 | struct sierra_net_data *priv = sierra_net_get_private(dev); | ||
| 898 | u16 len; | ||
| 899 | bool need_tail; | ||
| 900 | |||
| 901 | dev_dbg(&dev->udev->dev, "%s", __func__); | ||
| 902 | if (priv->link_up && check_ethip_packet(skb, dev) && is_ip(skb)) { | ||
| 903 | /* enough head room as is? */ | ||
| 904 | if (SIERRA_NET_HIP_EXT_HDR_LEN <= skb_headroom(skb)) { | ||
| 905 | /* Save the Eth/IP length and set up HIP hdr */ | ||
| 906 | len = skb->len; | ||
| 907 | skb_push(skb, SIERRA_NET_HIP_EXT_HDR_LEN); | ||
| 908 | /* Handle ZLP issue */ | ||
| 909 | need_tail = ((len + SIERRA_NET_HIP_EXT_HDR_LEN) | ||
| 910 | % dev->maxpacket == 0); | ||
| 911 | if (need_tail) { | ||
| 912 | if (unlikely(skb_tailroom(skb) == 0)) { | ||
| 913 | netdev_err(dev->net, "tx_fixup:" | ||
| 914 | "no room for packet\n"); | ||
| 915 | dev_kfree_skb_any(skb); | ||
| 916 | return NULL; | ||
| 917 | } else { | ||
| 918 | skb->data[skb->len] = 0; | ||
| 919 | __skb_put(skb, 1); | ||
| 920 | len = len + 1; | ||
| 921 | } | ||
| 922 | } | ||
| 923 | build_hip(skb->data, len, priv); | ||
| 924 | return skb; | ||
| 925 | } else { | ||
| 926 | /* | ||
| 927 | * compensate in the future if necessary | ||
| 928 | */ | ||
| 929 | netdev_err(dev->net, "tx_fixup: no room for HIP\n"); | ||
| 930 | } /* headroom */ | ||
| 931 | } | ||
| 932 | |||
| 933 | if (!priv->link_up) | ||
| 934 | dev->net->stats.tx_carrier_errors++; | ||
| 935 | |||
| 936 | /* tx_dropped incremented by usbnet */ | ||
| 937 | |||
| 938 | /* filter the packet out, release it */ | ||
| 939 | dev_kfree_skb_any(skb); | ||
| 940 | return NULL; | ||
| 941 | } | ||
| 942 | |||
| 943 | static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 }; | ||
| 944 | static const struct sierra_net_info_data sierra_net_info_data_68A3 = { | ||
| 945 | .rx_urb_size = 8 * 1024, | ||
| 946 | .whitelist = { | ||
| 947 | .infolen = ARRAY_SIZE(sierra_net_ifnum_list), | ||
| 948 | .ifaceinfo = sierra_net_ifnum_list | ||
| 949 | } | ||
| 950 | }; | ||
| 951 | |||
| 952 | static const struct driver_info sierra_net_info_68A3 = { | ||
| 953 | .description = "Sierra Wireless USB-to-WWAN Modem", | ||
| 954 | .flags = FLAG_WWAN | FLAG_SEND_ZLP, | ||
| 955 | .bind = sierra_net_bind, | ||
| 956 | .unbind = sierra_net_unbind, | ||
| 957 | .status = sierra_net_status, | ||
| 958 | .rx_fixup = sierra_net_rx_fixup, | ||
| 959 | .tx_fixup = sierra_net_tx_fixup, | ||
| 960 | .data = (unsigned long)&sierra_net_info_data_68A3, | ||
| 961 | }; | ||
| 962 | |||
| 963 | static const struct usb_device_id products[] = { | ||
| 964 | {USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ | ||
| 965 | .driver_info = (unsigned long) &sierra_net_info_68A3}, | ||
| 966 | |||
| 967 | {}, /* last item */ | ||
| 968 | }; | ||
| 969 | MODULE_DEVICE_TABLE(usb, products); | ||
| 970 | |||
| 971 | /* We are based on usbnet, so let it handle the USB driver specifics */ | ||
| 972 | static struct usb_driver sierra_net_driver = { | ||
| 973 | .name = "sierra_net", | ||
| 974 | .id_table = products, | ||
| 975 | .probe = usbnet_probe, | ||
| 976 | .disconnect = usbnet_disconnect, | ||
| 977 | .suspend = usbnet_suspend, | ||
| 978 | .resume = usbnet_resume, | ||
| 979 | .no_dynamic_id = 1, | ||
| 980 | }; | ||
| 981 | |||
| 982 | static int __init sierra_net_init(void) | ||
| 983 | { | ||
| 984 | BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data) | ||
| 985 | < sizeof(struct cdc_state)); | ||
| 986 | |||
| 987 | return usb_register(&sierra_net_driver); | ||
| 988 | } | ||
| 989 | |||
| 990 | static void __exit sierra_net_exit(void) | ||
| 991 | { | ||
| 992 | usb_deregister(&sierra_net_driver); | ||
| 993 | } | ||
| 994 | |||
| 995 | module_exit(sierra_net_exit); | ||
| 996 | module_init(sierra_net_init); | ||
| 997 | |||
| 998 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
| 999 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
| 1000 | MODULE_VERSION(DRIVER_VERSION); | ||
| 1001 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4014cf8e4a26..508f94a2a78d 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
| @@ -335,7 +335,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
| 335 | 335 | ||
| 336 | mutex_lock(&s->ops_mutex); | 336 | mutex_lock(&s->ops_mutex); |
| 337 | list_del(&p_dev->socket_device_list); | 337 | list_del(&p_dev->socket_device_list); |
| 338 | p_dev->_removed = 1; | ||
| 339 | mutex_unlock(&s->ops_mutex); | 338 | mutex_unlock(&s->ops_mutex); |
| 340 | 339 | ||
| 341 | dev_dbg(&p_dev->dev, "unregistering device\n"); | 340 | dev_dbg(&p_dev->dev, "unregistering device\n"); |
| @@ -654,14 +653,7 @@ static int pcmcia_requery_callback(struct device *dev, void * _data) | |||
| 654 | 653 | ||
| 655 | static void pcmcia_requery(struct pcmcia_socket *s) | 654 | static void pcmcia_requery(struct pcmcia_socket *s) |
| 656 | { | 655 | { |
| 657 | int present, has_pfc; | 656 | int has_pfc; |
| 658 | |||
| 659 | mutex_lock(&s->ops_mutex); | ||
| 660 | present = s->pcmcia_state.present; | ||
| 661 | mutex_unlock(&s->ops_mutex); | ||
| 662 | |||
| 663 | if (!present) | ||
| 664 | return; | ||
| 665 | 657 | ||
| 666 | if (s->functions == 0) { | 658 | if (s->functions == 0) { |
| 667 | pcmcia_card_add(s); | 659 | pcmcia_card_add(s); |
| @@ -828,11 +820,12 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
| 828 | } | 820 | } |
| 829 | 821 | ||
| 830 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { | 822 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { |
| 831 | if (dev->device_no != did->device_no) | 823 | dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n"); |
| 832 | return 0; | ||
| 833 | mutex_lock(&dev->socket->ops_mutex); | 824 | mutex_lock(&dev->socket->ops_mutex); |
| 834 | dev->socket->pcmcia_state.has_pfc = 1; | 825 | dev->socket->pcmcia_state.has_pfc = 1; |
| 835 | mutex_unlock(&dev->socket->ops_mutex); | 826 | mutex_unlock(&dev->socket->ops_mutex); |
| 827 | if (dev->device_no != did->device_no) | ||
| 828 | return 0; | ||
| 836 | } | 829 | } |
| 837 | 830 | ||
| 838 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) { | 831 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) { |
| @@ -843,7 +836,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
| 843 | 836 | ||
| 844 | /* if this is a pseudo-multi-function device, | 837 | /* if this is a pseudo-multi-function device, |
| 845 | * we need explicit matches */ | 838 | * we need explicit matches */ |
| 846 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) | 839 | if (dev->socket->pcmcia_state.has_pfc) |
| 847 | return 0; | 840 | return 0; |
| 848 | if (dev->device_no) | 841 | if (dev->device_no) |
| 849 | return 0; | 842 | return 0; |
| @@ -1260,9 +1253,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
| 1260 | 1253 | ||
| 1261 | switch (event) { | 1254 | switch (event) { |
| 1262 | case CS_EVENT_CARD_REMOVAL: | 1255 | case CS_EVENT_CARD_REMOVAL: |
| 1263 | mutex_lock(&s->ops_mutex); | 1256 | atomic_set(&skt->present, 0); |
| 1264 | s->pcmcia_state.present = 0; | ||
| 1265 | mutex_unlock(&s->ops_mutex); | ||
| 1266 | pcmcia_card_remove(skt, NULL); | 1257 | pcmcia_card_remove(skt, NULL); |
| 1267 | handle_event(skt, event); | 1258 | handle_event(skt, event); |
| 1268 | mutex_lock(&s->ops_mutex); | 1259 | mutex_lock(&s->ops_mutex); |
| @@ -1271,9 +1262,9 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
| 1271 | break; | 1262 | break; |
| 1272 | 1263 | ||
| 1273 | case CS_EVENT_CARD_INSERTION: | 1264 | case CS_EVENT_CARD_INSERTION: |
| 1265 | atomic_set(&skt->present, 1); | ||
| 1274 | mutex_lock(&s->ops_mutex); | 1266 | mutex_lock(&s->ops_mutex); |
| 1275 | s->pcmcia_state.has_pfc = 0; | 1267 | s->pcmcia_state.has_pfc = 0; |
| 1276 | s->pcmcia_state.present = 1; | ||
| 1277 | destroy_cis_cache(s); /* to be on the safe side... */ | 1268 | destroy_cis_cache(s); /* to be on the safe side... */ |
| 1278 | mutex_unlock(&s->ops_mutex); | 1269 | mutex_unlock(&s->ops_mutex); |
| 1279 | pcmcia_card_add(skt); | 1270 | pcmcia_card_add(skt); |
| @@ -1313,7 +1304,13 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
| 1313 | return 0; | 1304 | return 0; |
| 1314 | } /* ds_event */ | 1305 | } /* ds_event */ |
| 1315 | 1306 | ||
| 1316 | 1307 | /* | |
| 1308 | * NOTE: This is racy. There's no guarantee the card will still be | ||
| 1309 | * physically present, even if the call to this function returns | ||
| 1310 | * non-NULL. Furthermore, the device driver most likely is unbound | ||
| 1311 | * almost immediately, so the timeframe where pcmcia_dev_present | ||
| 1312 | * returns NULL is probably really really small. | ||
| 1313 | */ | ||
| 1317 | struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev) | 1314 | struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev) |
| 1318 | { | 1315 | { |
| 1319 | struct pcmcia_device *p_dev; | 1316 | struct pcmcia_device *p_dev; |
| @@ -1323,22 +1320,9 @@ struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev) | |||
| 1323 | if (!p_dev) | 1320 | if (!p_dev) |
| 1324 | return NULL; | 1321 | return NULL; |
| 1325 | 1322 | ||
| 1326 | mutex_lock(&p_dev->socket->ops_mutex); | 1323 | if (atomic_read(&p_dev->socket->present) != 0) |
| 1327 | if (!p_dev->socket->pcmcia_state.present) | 1324 | ret = p_dev; |
| 1328 | goto out; | ||
| 1329 | |||
| 1330 | if (p_dev->socket->pcmcia_state.dead) | ||
| 1331 | goto out; | ||
| 1332 | 1325 | ||
| 1333 | if (p_dev->_removed) | ||
| 1334 | goto out; | ||
| 1335 | |||
| 1336 | if (p_dev->suspended) | ||
| 1337 | goto out; | ||
| 1338 | |||
| 1339 | ret = p_dev; | ||
| 1340 | out: | ||
| 1341 | mutex_unlock(&p_dev->socket->ops_mutex); | ||
| 1342 | pcmcia_put_dev(p_dev); | 1326 | pcmcia_put_dev(p_dev); |
| 1343 | return ret; | 1327 | return ret; |
| 1344 | } | 1328 | } |
| @@ -1388,6 +1372,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, | |||
| 1388 | return ret; | 1372 | return ret; |
| 1389 | } | 1373 | } |
| 1390 | 1374 | ||
| 1375 | atomic_set(&socket->present, 0); | ||
| 1376 | |||
| 1391 | return 0; | 1377 | return 0; |
| 1392 | } | 1378 | } |
| 1393 | 1379 | ||
| @@ -1399,10 +1385,6 @@ static void pcmcia_bus_remove_socket(struct device *dev, | |||
| 1399 | if (!socket) | 1385 | if (!socket) |
| 1400 | return; | 1386 | return; |
| 1401 | 1387 | ||
| 1402 | mutex_lock(&socket->ops_mutex); | ||
| 1403 | socket->pcmcia_state.dead = 1; | ||
| 1404 | mutex_unlock(&socket->ops_mutex); | ||
| 1405 | |||
| 1406 | pccard_register_pcmcia(socket, NULL); | 1388 | pccard_register_pcmcia(socket, NULL); |
| 1407 | 1389 | ||
| 1408 | /* unregister any unbound devices */ | 1390 | /* unregister any unbound devices */ |
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index b6218f11c957..552cad85ae5a 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
| @@ -109,7 +109,7 @@ static int max8925_is_enabled(struct regulator_dev *rdev) | |||
| 109 | struct max8925_regulator_info *info = rdev_get_drvdata(rdev); | 109 | struct max8925_regulator_info *info = rdev_get_drvdata(rdev); |
| 110 | int ret; | 110 | int ret; |
| 111 | 111 | ||
| 112 | ret = max8925_reg_read(info->i2c, info->vol_reg); | 112 | ret = max8925_reg_read(info->i2c, info->enable_reg); |
| 113 | if (ret < 0) | 113 | if (ret < 0) |
| 114 | return ret; | 114 | return ret; |
| 115 | 115 | ||
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index 500d38342e1e..801ead191499 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
| @@ -121,7 +121,7 @@ static ssize_t booke_wdt_write(struct file *file, const char __user *buf, | |||
| 121 | return count; | 121 | return count; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static const struct watchdog_info ident = { | 124 | static struct watchdog_info ident = { |
| 125 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 125 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
| 126 | .identity = "PowerPC Book-E Watchdog", | 126 | .identity = "PowerPC Book-E Watchdog", |
| 127 | }; | 127 | }; |
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c index c8eadd478175..88c83aa57303 100644 --- a/drivers/watchdog/sb_wdog.c +++ b/drivers/watchdog/sb_wdog.c | |||
| @@ -67,8 +67,8 @@ static DEFINE_SPINLOCK(sbwd_lock); | |||
| 67 | void sbwdog_set(char __iomem *wdog, unsigned long t) | 67 | void sbwdog_set(char __iomem *wdog, unsigned long t) |
| 68 | { | 68 | { |
| 69 | spin_lock(&sbwd_lock); | 69 | spin_lock(&sbwd_lock); |
| 70 | __raw_writeb(0, wdog - 0x10); | 70 | __raw_writeb(0, wdog); |
| 71 | __raw_writeq(t & 0x7fffffUL, wdog); | 71 | __raw_writeq(t & 0x7fffffUL, wdog - 0x10); |
| 72 | spin_unlock(&sbwd_lock); | 72 | spin_unlock(&sbwd_lock); |
| 73 | } | 73 | } |
| 74 | 74 | ||
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index 8d44c9b6fb5b..c7d67e9a7465 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | static int nowayout = WATCHDOG_NOWAYOUT; | 30 | static int nowayout = WATCHDOG_NOWAYOUT; |
| 31 | static unsigned int margin = 60; /* (secs) Default is 1 minute */ | 31 | static unsigned int margin = 60; /* (secs) Default is 1 minute */ |
| 32 | static unsigned long wdt_status; | 32 | static unsigned long wdt_status; |
| 33 | static DEFINE_SPINLOCK(wdt_lock); | 33 | static DEFINE_MUTEX(wdt_lock); |
| 34 | 34 | ||
| 35 | #define WDT_IN_USE 0 | 35 | #define WDT_IN_USE 0 |
| 36 | #define WDT_OK_TO_CLOSE 1 | 36 | #define WDT_OK_TO_CLOSE 1 |
| @@ -45,26 +45,26 @@ static DEFINE_SPINLOCK(wdt_lock); | |||
| 45 | 45 | ||
| 46 | static void wdt_send_data(unsigned char command, unsigned char data) | 46 | static void wdt_send_data(unsigned char command, unsigned char data) |
| 47 | { | 47 | { |
| 48 | outb(command, COMMAND_PORT); | ||
| 49 | msleep(100); | ||
| 50 | outb(data, DATA_PORT); | 48 | outb(data, DATA_PORT); |
| 51 | msleep(200); | 49 | msleep(200); |
| 50 | outb(command, COMMAND_PORT); | ||
| 51 | msleep(100); | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | static void wdt_enable(void) | 54 | static void wdt_enable(void) |
| 55 | { | 55 | { |
| 56 | spin_lock(&wdt_lock); | 56 | mutex_lock(&wdt_lock); |
| 57 | wdt_send_data(IFACE_ON_COMMAND, 1); | 57 | wdt_send_data(IFACE_ON_COMMAND, 1); |
| 58 | wdt_send_data(REBOOT_COMMAND, margin); | 58 | wdt_send_data(REBOOT_COMMAND, margin); |
| 59 | spin_unlock(&wdt_lock); | 59 | mutex_unlock(&wdt_lock); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | static void wdt_disable(void) | 62 | static void wdt_disable(void) |
| 63 | { | 63 | { |
| 64 | spin_lock(&wdt_lock); | 64 | mutex_lock(&wdt_lock); |
| 65 | wdt_send_data(IFACE_ON_COMMAND, 0); | 65 | wdt_send_data(IFACE_ON_COMMAND, 0); |
| 66 | wdt_send_data(REBOOT_COMMAND, 0); | 66 | wdt_send_data(REBOOT_COMMAND, 0); |
| 67 | spin_unlock(&wdt_lock); | 67 | mutex_unlock(&wdt_lock); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static int fitpc2_wdt_open(struct inode *inode, struct file *file) | 70 | static int fitpc2_wdt_open(struct inode *inode, struct file *file) |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 5c5bc8480070..f8b86e92cd66 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
| @@ -238,6 +238,13 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
| 238 | return ERR_PTR(-ENOMEM); | 238 | return ERR_PTR(-ENOMEM); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY); | ||
| 242 | if (rc) { | ||
| 243 | __putname(v9ses->aname); | ||
| 244 | __putname(v9ses->uname); | ||
| 245 | return ERR_PTR(rc); | ||
| 246 | } | ||
| 247 | |||
| 241 | spin_lock(&v9fs_sessionlist_lock); | 248 | spin_lock(&v9fs_sessionlist_lock); |
| 242 | list_add(&v9ses->slist, &v9fs_sessionlist); | 249 | list_add(&v9ses->slist, &v9fs_sessionlist); |
| 243 | spin_unlock(&v9fs_sessionlist_lock); | 250 | spin_unlock(&v9fs_sessionlist_lock); |
| @@ -301,6 +308,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
| 301 | return fid; | 308 | return fid; |
| 302 | 309 | ||
| 303 | error: | 310 | error: |
| 311 | bdi_destroy(&v9ses->bdi); | ||
| 304 | return ERR_PTR(retval); | 312 | return ERR_PTR(retval); |
| 305 | } | 313 | } |
| 306 | 314 | ||
| @@ -326,6 +334,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) | |||
| 326 | __putname(v9ses->uname); | 334 | __putname(v9ses->uname); |
| 327 | __putname(v9ses->aname); | 335 | __putname(v9ses->aname); |
| 328 | 336 | ||
| 337 | bdi_destroy(&v9ses->bdi); | ||
| 338 | |||
| 329 | spin_lock(&v9fs_sessionlist_lock); | 339 | spin_lock(&v9fs_sessionlist_lock); |
| 330 | list_del(&v9ses->slist); | 340 | list_del(&v9ses->slist); |
| 331 | spin_unlock(&v9fs_sessionlist_lock); | 341 | spin_unlock(&v9fs_sessionlist_lock); |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index a0a8d3dd1361..bec4d0bcb458 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | * Boston, MA 02111-1301 USA | 20 | * Boston, MA 02111-1301 USA |
| 21 | * | 21 | * |
| 22 | */ | 22 | */ |
| 23 | #include <linux/backing-dev.h> | ||
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 25 | * enum p9_session_flags - option flags for each 9P session | 26 | * enum p9_session_flags - option flags for each 9P session |
| @@ -102,6 +103,7 @@ struct v9fs_session_info { | |||
| 102 | u32 uid; /* if ACCESS_SINGLE, the uid that has access */ | 103 | u32 uid; /* if ACCESS_SINGLE, the uid that has access */ |
| 103 | struct p9_client *clnt; /* 9p client */ | 104 | struct p9_client *clnt; /* 9p client */ |
| 104 | struct list_head slist; /* list of sessions registered with v9fs */ | 105 | struct list_head slist; /* list of sessions registered with v9fs */ |
| 106 | struct backing_dev_info bdi; | ||
| 105 | }; | 107 | }; |
| 106 | 108 | ||
| 107 | struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, | 109 | struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 491108bd6e0d..806da5d3b3a0 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
| @@ -77,6 +77,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
| 77 | sb->s_blocksize = 1 << sb->s_blocksize_bits; | 77 | sb->s_blocksize = 1 << sb->s_blocksize_bits; |
| 78 | sb->s_magic = V9FS_MAGIC; | 78 | sb->s_magic = V9FS_MAGIC; |
| 79 | sb->s_op = &v9fs_super_ops; | 79 | sb->s_op = &v9fs_super_ops; |
| 80 | sb->s_bdi = &v9ses->bdi; | ||
| 80 | 81 | ||
| 81 | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | | 82 | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | |
| 82 | MS_NOATIME; | 83 | MS_NOATIME; |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index c54dad4e6063..a10f2582844f 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
| 20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
| 21 | #include <linux/fscache.h> | 21 | #include <linux/fscache.h> |
| 22 | #include <linux/backing-dev.h> | ||
| 22 | 23 | ||
| 23 | #include "afs.h" | 24 | #include "afs.h" |
| 24 | #include "afs_vl.h" | 25 | #include "afs_vl.h" |
| @@ -313,6 +314,7 @@ struct afs_volume { | |||
| 313 | unsigned short rjservers; /* number of servers discarded due to -ENOMEDIUM */ | 314 | unsigned short rjservers; /* number of servers discarded due to -ENOMEDIUM */ |
| 314 | struct afs_server *servers[8]; /* servers on which volume resides (ordered) */ | 315 | struct afs_server *servers[8]; /* servers on which volume resides (ordered) */ |
| 315 | struct rw_semaphore server_sem; /* lock for accessing current server */ | 316 | struct rw_semaphore server_sem; /* lock for accessing current server */ |
| 317 | struct backing_dev_info bdi; | ||
| 316 | }; | 318 | }; |
| 317 | 319 | ||
| 318 | /* | 320 | /* |
diff --git a/fs/afs/super.c b/fs/afs/super.c index 14f6431598ad..e932e5a3a0c1 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
| @@ -311,6 +311,7 @@ static int afs_fill_super(struct super_block *sb, void *data) | |||
| 311 | sb->s_magic = AFS_FS_MAGIC; | 311 | sb->s_magic = AFS_FS_MAGIC; |
| 312 | sb->s_op = &afs_super_ops; | 312 | sb->s_op = &afs_super_ops; |
| 313 | sb->s_fs_info = as; | 313 | sb->s_fs_info = as; |
| 314 | sb->s_bdi = &as->volume->bdi; | ||
| 314 | 315 | ||
| 315 | /* allocate the root inode and dentry */ | 316 | /* allocate the root inode and dentry */ |
| 316 | fid.vid = as->volume->vid; | 317 | fid.vid = as->volume->vid; |
diff --git a/fs/afs/volume.c b/fs/afs/volume.c index a353e69e2391..401eeb21869f 100644 --- a/fs/afs/volume.c +++ b/fs/afs/volume.c | |||
| @@ -106,6 +106,10 @@ struct afs_volume *afs_volume_lookup(struct afs_mount_params *params) | |||
| 106 | volume->cell = params->cell; | 106 | volume->cell = params->cell; |
| 107 | volume->vid = vlocation->vldb.vid[params->type]; | 107 | volume->vid = vlocation->vldb.vid[params->type]; |
| 108 | 108 | ||
| 109 | ret = bdi_setup_and_register(&volume->bdi, "afs", BDI_CAP_MAP_COPY); | ||
| 110 | if (ret) | ||
| 111 | goto error_bdi; | ||
| 112 | |||
| 109 | init_rwsem(&volume->server_sem); | 113 | init_rwsem(&volume->server_sem); |
| 110 | 114 | ||
| 111 | /* look up all the applicable server records */ | 115 | /* look up all the applicable server records */ |
| @@ -151,6 +155,8 @@ error: | |||
| 151 | return ERR_PTR(ret); | 155 | return ERR_PTR(ret); |
| 152 | 156 | ||
| 153 | error_discard: | 157 | error_discard: |
| 158 | bdi_destroy(&volume->bdi); | ||
| 159 | error_bdi: | ||
| 154 | up_write(¶ms->cell->vl_sem); | 160 | up_write(¶ms->cell->vl_sem); |
| 155 | 161 | ||
| 156 | for (loop = volume->nservers - 1; loop >= 0; loop--) | 162 | for (loop = volume->nservers - 1; loop >= 0; loop--) |
| @@ -200,6 +206,7 @@ void afs_put_volume(struct afs_volume *volume) | |||
| 200 | for (loop = volume->nservers - 1; loop >= 0; loop--) | 206 | for (loop = volume->nservers - 1; loop >= 0; loop--) |
| 201 | afs_put_server(volume->servers[loop]); | 207 | afs_put_server(volume->servers[loop]); |
| 202 | 208 | ||
| 209 | bdi_destroy(&volume->bdi); | ||
| 203 | kfree(volume); | 210 | kfree(volume); |
| 204 | 211 | ||
| 205 | _leave(" [destroyed]"); | 212 | _leave(" [destroyed]"); |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 7ab23e006e4c..2c5f9a0e5d72 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
| @@ -1005,15 +1005,8 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
| 1005 | } | 1005 | } |
| 1006 | } else if (!mm->start_data) { | 1006 | } else if (!mm->start_data) { |
| 1007 | mm->start_data = seg->addr; | 1007 | mm->start_data = seg->addr; |
| 1008 | #ifndef CONFIG_MMU | ||
| 1009 | mm->end_data = seg->addr + phdr->p_memsz; | 1008 | mm->end_data = seg->addr + phdr->p_memsz; |
| 1010 | #endif | ||
| 1011 | } | 1009 | } |
| 1012 | |||
| 1013 | #ifdef CONFIG_MMU | ||
| 1014 | if (seg->addr + phdr->p_memsz > mm->end_data) | ||
| 1015 | mm->end_data = seg->addr + phdr->p_memsz; | ||
| 1016 | #endif | ||
| 1017 | } | 1010 | } |
| 1018 | 1011 | ||
| 1019 | seg++; | 1012 | seg++; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e7b8f2c89ccb..feca04197d02 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -44,8 +44,6 @@ static struct extent_io_ops btree_extent_io_ops; | |||
| 44 | static void end_workqueue_fn(struct btrfs_work *work); | 44 | static void end_workqueue_fn(struct btrfs_work *work); |
| 45 | static void free_fs_root(struct btrfs_root *root); | 45 | static void free_fs_root(struct btrfs_root *root); |
| 46 | 46 | ||
| 47 | static atomic_t btrfs_bdi_num = ATOMIC_INIT(0); | ||
| 48 | |||
| 49 | /* | 47 | /* |
| 50 | * end_io_wq structs are used to do processing in task context when an IO is | 48 | * end_io_wq structs are used to do processing in task context when an IO is |
| 51 | * complete. This is used during reads to verify checksums, and it is used | 49 | * complete. This is used during reads to verify checksums, and it is used |
| @@ -1375,19 +1373,11 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) | |||
| 1375 | { | 1373 | { |
| 1376 | int err; | 1374 | int err; |
| 1377 | 1375 | ||
| 1378 | bdi->name = "btrfs"; | ||
| 1379 | bdi->capabilities = BDI_CAP_MAP_COPY; | 1376 | bdi->capabilities = BDI_CAP_MAP_COPY; |
| 1380 | err = bdi_init(bdi); | 1377 | err = bdi_setup_and_register(bdi, "btrfs", BDI_CAP_MAP_COPY); |
| 1381 | if (err) | 1378 | if (err) |
| 1382 | return err; | 1379 | return err; |
| 1383 | 1380 | ||
| 1384 | err = bdi_register(bdi, NULL, "btrfs-%d", | ||
| 1385 | atomic_inc_return(&btrfs_bdi_num)); | ||
| 1386 | if (err) { | ||
| 1387 | bdi_destroy(bdi); | ||
| 1388 | return err; | ||
| 1389 | } | ||
| 1390 | |||
| 1391 | bdi->ra_pages = default_backing_dev_info.ra_pages; | 1381 | bdi->ra_pages = default_backing_dev_info.ra_pages; |
| 1392 | bdi->unplug_io_fn = btrfs_unplug_io_fn; | 1382 | bdi->unplug_io_fn = btrfs_unplug_io_fn; |
| 1393 | bdi->unplug_io_data = info; | 1383 | bdi->unplug_io_data = info; |
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index 4797787c6a44..246a167cb913 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #ifndef _CIFS_FS_SB_H | 18 | #ifndef _CIFS_FS_SB_H |
| 19 | #define _CIFS_FS_SB_H | 19 | #define _CIFS_FS_SB_H |
| 20 | 20 | ||
| 21 | #include <linux/backing-dev.h> | ||
| 22 | |||
| 21 | #define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */ | 23 | #define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */ |
| 22 | #define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */ | 24 | #define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */ |
| 23 | #define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */ | 25 | #define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */ |
| @@ -50,5 +52,6 @@ struct cifs_sb_info { | |||
| 50 | #ifdef CONFIG_CIFS_DFS_UPCALL | 52 | #ifdef CONFIG_CIFS_DFS_UPCALL |
| 51 | char *mountdata; /* mount options received at mount time */ | 53 | char *mountdata; /* mount options received at mount time */ |
| 52 | #endif | 54 | #endif |
| 55 | struct backing_dev_info bdi; | ||
| 53 | }; | 56 | }; |
| 54 | #endif /* _CIFS_FS_SB_H */ | 57 | #endif /* _CIFS_FS_SB_H */ |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ded66be6597c..ad235d604a0b 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -103,6 +103,12 @@ cifs_read_super(struct super_block *sb, void *data, | |||
| 103 | if (cifs_sb == NULL) | 103 | if (cifs_sb == NULL) |
| 104 | return -ENOMEM; | 104 | return -ENOMEM; |
| 105 | 105 | ||
| 106 | rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY); | ||
| 107 | if (rc) { | ||
| 108 | kfree(cifs_sb); | ||
| 109 | return rc; | ||
| 110 | } | ||
| 111 | |||
| 106 | #ifdef CONFIG_CIFS_DFS_UPCALL | 112 | #ifdef CONFIG_CIFS_DFS_UPCALL |
| 107 | /* copy mount params to sb for use in submounts */ | 113 | /* copy mount params to sb for use in submounts */ |
| 108 | /* BB: should we move this after the mount so we | 114 | /* BB: should we move this after the mount so we |
| @@ -115,6 +121,7 @@ cifs_read_super(struct super_block *sb, void *data, | |||
| 115 | int len = strlen(data); | 121 | int len = strlen(data); |
| 116 | cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); | 122 | cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); |
| 117 | if (cifs_sb->mountdata == NULL) { | 123 | if (cifs_sb->mountdata == NULL) { |
| 124 | bdi_destroy(&cifs_sb->bdi); | ||
| 118 | kfree(sb->s_fs_info); | 125 | kfree(sb->s_fs_info); |
| 119 | sb->s_fs_info = NULL; | 126 | sb->s_fs_info = NULL; |
| 120 | return -ENOMEM; | 127 | return -ENOMEM; |
| @@ -135,6 +142,7 @@ cifs_read_super(struct super_block *sb, void *data, | |||
| 135 | 142 | ||
| 136 | sb->s_magic = CIFS_MAGIC_NUMBER; | 143 | sb->s_magic = CIFS_MAGIC_NUMBER; |
| 137 | sb->s_op = &cifs_super_ops; | 144 | sb->s_op = &cifs_super_ops; |
| 145 | sb->s_bdi = &cifs_sb->bdi; | ||
| 138 | /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) | 146 | /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) |
| 139 | sb->s_blocksize = | 147 | sb->s_blocksize = |
| 140 | cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ | 148 | cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ |
| @@ -183,6 +191,7 @@ out_mount_failed: | |||
| 183 | } | 191 | } |
| 184 | #endif | 192 | #endif |
| 185 | unload_nls(cifs_sb->local_nls); | 193 | unload_nls(cifs_sb->local_nls); |
| 194 | bdi_destroy(&cifs_sb->bdi); | ||
| 186 | kfree(cifs_sb); | 195 | kfree(cifs_sb); |
| 187 | } | 196 | } |
| 188 | return rc; | 197 | return rc; |
| @@ -214,6 +223,7 @@ cifs_put_super(struct super_block *sb) | |||
| 214 | #endif | 223 | #endif |
| 215 | 224 | ||
| 216 | unload_nls(cifs_sb->local_nls); | 225 | unload_nls(cifs_sb->local_nls); |
| 226 | bdi_destroy(&cifs_sb->bdi); | ||
| 217 | kfree(cifs_sb); | 227 | kfree(cifs_sb); |
| 218 | 228 | ||
| 219 | unlock_kernel(); | 229 | unlock_kernel(); |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index a1695dcadd99..d97f9935a028 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
| @@ -167,6 +167,10 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
| 167 | return -EBUSY; | 167 | return -EBUSY; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | error = bdi_setup_and_register(&vc->bdi, "coda", BDI_CAP_MAP_COPY); | ||
| 171 | if (error) | ||
| 172 | goto bdi_err; | ||
| 173 | |||
| 170 | vc->vc_sb = sb; | 174 | vc->vc_sb = sb; |
| 171 | 175 | ||
| 172 | sb->s_fs_info = vc; | 176 | sb->s_fs_info = vc; |
| @@ -175,6 +179,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
| 175 | sb->s_blocksize_bits = 12; | 179 | sb->s_blocksize_bits = 12; |
| 176 | sb->s_magic = CODA_SUPER_MAGIC; | 180 | sb->s_magic = CODA_SUPER_MAGIC; |
| 177 | sb->s_op = &coda_super_operations; | 181 | sb->s_op = &coda_super_operations; |
| 182 | sb->s_bdi = &vc->bdi; | ||
| 178 | 183 | ||
| 179 | /* get root fid from Venus: this needs the root inode */ | 184 | /* get root fid from Venus: this needs the root inode */ |
| 180 | error = venus_rootfid(sb, &fid); | 185 | error = venus_rootfid(sb, &fid); |
| @@ -200,6 +205,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
| 200 | return 0; | 205 | return 0; |
| 201 | 206 | ||
| 202 | error: | 207 | error: |
| 208 | bdi_destroy(&vc->bdi); | ||
| 209 | bdi_err: | ||
| 203 | if (root) | 210 | if (root) |
| 204 | iput(root); | 211 | iput(root); |
| 205 | if (vc) | 212 | if (vc) |
| @@ -210,6 +217,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
| 210 | 217 | ||
| 211 | static void coda_put_super(struct super_block *sb) | 218 | static void coda_put_super(struct super_block *sb) |
| 212 | { | 219 | { |
| 220 | bdi_destroy(&coda_vcp(sb)->bdi); | ||
| 213 | coda_vcp(sb)->vc_sb = NULL; | 221 | coda_vcp(sb)->vc_sb = NULL; |
| 214 | sb->s_fs_info = NULL; | 222 | sb->s_fs_info = NULL; |
| 215 | 223 | ||
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index bc7115403f38..bfc2e0f78f00 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/scatterlist.h> | 35 | #include <linux/scatterlist.h> |
| 36 | #include <linux/hash.h> | 36 | #include <linux/hash.h> |
| 37 | #include <linux/nsproxy.h> | 37 | #include <linux/nsproxy.h> |
| 38 | #include <linux/backing-dev.h> | ||
| 38 | 39 | ||
| 39 | /* Version verification for shared data structures w/ userspace */ | 40 | /* Version verification for shared data structures w/ userspace */ |
| 40 | #define ECRYPTFS_VERSION_MAJOR 0x00 | 41 | #define ECRYPTFS_VERSION_MAJOR 0x00 |
| @@ -393,6 +394,7 @@ struct ecryptfs_mount_crypt_stat { | |||
| 393 | struct ecryptfs_sb_info { | 394 | struct ecryptfs_sb_info { |
| 394 | struct super_block *wsi_sb; | 395 | struct super_block *wsi_sb; |
| 395 | struct ecryptfs_mount_crypt_stat mount_crypt_stat; | 396 | struct ecryptfs_mount_crypt_stat mount_crypt_stat; |
| 397 | struct backing_dev_info bdi; | ||
| 396 | }; | 398 | }; |
| 397 | 399 | ||
| 398 | /* file private data. */ | 400 | /* file private data. */ |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index af1a8f01ebac..760983d0f25e 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -497,17 +497,25 @@ struct kmem_cache *ecryptfs_sb_info_cache; | |||
| 497 | static int | 497 | static int |
| 498 | ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent) | 498 | ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent) |
| 499 | { | 499 | { |
| 500 | struct ecryptfs_sb_info *esi; | ||
| 500 | int rc = 0; | 501 | int rc = 0; |
| 501 | 502 | ||
| 502 | /* Released in ecryptfs_put_super() */ | 503 | /* Released in ecryptfs_put_super() */ |
| 503 | ecryptfs_set_superblock_private(sb, | 504 | ecryptfs_set_superblock_private(sb, |
| 504 | kmem_cache_zalloc(ecryptfs_sb_info_cache, | 505 | kmem_cache_zalloc(ecryptfs_sb_info_cache, |
| 505 | GFP_KERNEL)); | 506 | GFP_KERNEL)); |
| 506 | if (!ecryptfs_superblock_to_private(sb)) { | 507 | esi = ecryptfs_superblock_to_private(sb); |
| 508 | if (!esi) { | ||
| 507 | ecryptfs_printk(KERN_WARNING, "Out of memory\n"); | 509 | ecryptfs_printk(KERN_WARNING, "Out of memory\n"); |
| 508 | rc = -ENOMEM; | 510 | rc = -ENOMEM; |
| 509 | goto out; | 511 | goto out; |
| 510 | } | 512 | } |
| 513 | |||
| 514 | rc = bdi_setup_and_register(&esi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); | ||
| 515 | if (rc) | ||
| 516 | goto out; | ||
| 517 | |||
| 518 | sb->s_bdi = &esi->bdi; | ||
| 511 | sb->s_op = &ecryptfs_sops; | 519 | sb->s_op = &ecryptfs_sops; |
| 512 | /* Released through deactivate_super(sb) from get_sb_nodev */ | 520 | /* Released through deactivate_super(sb) from get_sb_nodev */ |
| 513 | sb->s_root = d_alloc(NULL, &(const struct qstr) { | 521 | sb->s_root = d_alloc(NULL, &(const struct qstr) { |
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index 278743c7716a..0c0ae491d231 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
| @@ -122,6 +122,7 @@ static void ecryptfs_put_super(struct super_block *sb) | |||
| 122 | lock_kernel(); | 122 | lock_kernel(); |
| 123 | 123 | ||
| 124 | ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); | 124 | ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); |
| 125 | bdi_destroy(&sb_info->bdi); | ||
| 125 | kmem_cache_free(ecryptfs_sb_info_cache, sb_info); | 126 | kmem_cache_free(ecryptfs_sb_info_cache, sb_info); |
| 126 | ecryptfs_set_superblock_private(sb, NULL); | 127 | ecryptfs_set_superblock_private(sb, NULL); |
| 127 | 128 | ||
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h index 8442e353309f..54373278a353 100644 --- a/fs/exofs/exofs.h +++ b/fs/exofs/exofs.h | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
| 37 | #include <linux/time.h> | 37 | #include <linux/time.h> |
| 38 | #include <linux/backing-dev.h> | ||
| 38 | #include "common.h" | 39 | #include "common.h" |
| 39 | 40 | ||
| 40 | /* FIXME: Remove once pnfs hits mainline | 41 | /* FIXME: Remove once pnfs hits mainline |
| @@ -92,6 +93,7 @@ struct exofs_sb_info { | |||
| 92 | struct exofs_layout layout; /* Default files layout, | 93 | struct exofs_layout layout; /* Default files layout, |
| 93 | * contains the variable osd_dev | 94 | * contains the variable osd_dev |
| 94 | * array. Keep last */ | 95 | * array. Keep last */ |
| 96 | struct backing_dev_info bdi; | ||
| 95 | struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ | 97 | struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ |
| 96 | }; | 98 | }; |
| 97 | 99 | ||
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 18e57ea1e5b4..03149b9a5178 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
| @@ -302,6 +302,7 @@ static void exofs_put_super(struct super_block *sb) | |||
| 302 | _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0], | 302 | _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0], |
| 303 | sbi->layout.s_pid); | 303 | sbi->layout.s_pid); |
| 304 | 304 | ||
| 305 | bdi_destroy(&sbi->bdi); | ||
| 305 | exofs_free_sbi(sbi); | 306 | exofs_free_sbi(sbi); |
| 306 | sb->s_fs_info = NULL; | 307 | sb->s_fs_info = NULL; |
| 307 | } | 308 | } |
| @@ -546,6 +547,10 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 546 | if (!sbi) | 547 | if (!sbi) |
| 547 | return -ENOMEM; | 548 | return -ENOMEM; |
| 548 | 549 | ||
| 550 | ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY); | ||
| 551 | if (ret) | ||
| 552 | goto free_bdi; | ||
| 553 | |||
| 549 | /* use mount options to fill superblock */ | 554 | /* use mount options to fill superblock */ |
| 550 | od = osduld_path_lookup(opts->dev_name); | 555 | od = osduld_path_lookup(opts->dev_name); |
| 551 | if (IS_ERR(od)) { | 556 | if (IS_ERR(od)) { |
| @@ -612,6 +617,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 612 | } | 617 | } |
| 613 | 618 | ||
| 614 | /* set up operation vectors */ | 619 | /* set up operation vectors */ |
| 620 | sb->s_bdi = &sbi->bdi; | ||
| 615 | sb->s_fs_info = sbi; | 621 | sb->s_fs_info = sbi; |
| 616 | sb->s_op = &exofs_sops; | 622 | sb->s_op = &exofs_sops; |
| 617 | sb->s_export_op = &exofs_export_ops; | 623 | sb->s_export_op = &exofs_export_ops; |
| @@ -643,6 +649,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 643 | return 0; | 649 | return 0; |
| 644 | 650 | ||
| 645 | free_sbi: | 651 | free_sbi: |
| 652 | bdi_destroy(&sbi->bdi); | ||
| 653 | free_bdi: | ||
| 646 | EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", | 654 | EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", |
| 647 | opts->dev_name, sbi->layout.s_pid, ret); | 655 | opts->dev_name, sbi->layout.s_pid, ret); |
| 648 | exofs_free_sbi(sbi); | 656 | exofs_free_sbi(sbi); |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index cf98da1be23e..fa3385154023 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
| @@ -526,10 +526,15 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 526 | sb->s_blocksize_bits = 10; | 526 | sb->s_blocksize_bits = 10; |
| 527 | sb->s_magic = NCP_SUPER_MAGIC; | 527 | sb->s_magic = NCP_SUPER_MAGIC; |
| 528 | sb->s_op = &ncp_sops; | 528 | sb->s_op = &ncp_sops; |
| 529 | sb->s_bdi = &server->bdi; | ||
| 529 | 530 | ||
| 530 | server = NCP_SBP(sb); | 531 | server = NCP_SBP(sb); |
| 531 | memset(server, 0, sizeof(*server)); | 532 | memset(server, 0, sizeof(*server)); |
| 532 | 533 | ||
| 534 | error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); | ||
| 535 | if (error) | ||
| 536 | goto out_bdi; | ||
| 537 | |||
| 533 | server->ncp_filp = ncp_filp; | 538 | server->ncp_filp = ncp_filp; |
| 534 | server->ncp_sock = sock; | 539 | server->ncp_sock = sock; |
| 535 | 540 | ||
| @@ -719,6 +724,8 @@ out_fput2: | |||
| 719 | if (server->info_filp) | 724 | if (server->info_filp) |
| 720 | fput(server->info_filp); | 725 | fput(server->info_filp); |
| 721 | out_fput: | 726 | out_fput: |
| 727 | bdi_destroy(&server->bdi); | ||
| 728 | out_bdi: | ||
| 722 | /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: | 729 | /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: |
| 723 | * | 730 | * |
| 724 | * The previously used put_filp(ncp_filp); was bogous, since | 731 | * The previously used put_filp(ncp_filp); was bogous, since |
| @@ -756,6 +763,7 @@ static void ncp_put_super(struct super_block *sb) | |||
| 756 | kill_pid(server->m.wdog_pid, SIGTERM, 1); | 763 | kill_pid(server->m.wdog_pid, SIGTERM, 1); |
| 757 | put_pid(server->m.wdog_pid); | 764 | put_pid(server->m.wdog_pid); |
| 758 | 765 | ||
| 766 | bdi_destroy(&server->bdi); | ||
| 759 | kfree(server->priv.data); | 767 | kfree(server->priv.data); |
| 760 | kfree(server->auth.object_name); | 768 | kfree(server->auth.object_name); |
| 761 | vfree(server->rxbuf); | 769 | vfree(server->rxbuf); |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index be46f26c9a56..db3ad849a289 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -837,6 +837,8 @@ out_zap_parent: | |||
| 837 | /* If we have submounts, don't unhash ! */ | 837 | /* If we have submounts, don't unhash ! */ |
| 838 | if (have_submounts(dentry)) | 838 | if (have_submounts(dentry)) |
| 839 | goto out_valid; | 839 | goto out_valid; |
| 840 | if (dentry->d_flags & DCACHE_DISCONNECTED) | ||
| 841 | goto out_valid; | ||
| 840 | shrink_dcache_parent(dentry); | 842 | shrink_dcache_parent(dentry); |
| 841 | } | 843 | } |
| 842 | d_drop(dentry); | 844 | d_drop(dentry); |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index e1703175ee28..34ccf815ea8a 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -161,10 +161,10 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes) | |||
| 161 | argp->p = page_address(argp->pagelist[0]); | 161 | argp->p = page_address(argp->pagelist[0]); |
| 162 | argp->pagelist++; | 162 | argp->pagelist++; |
| 163 | if (argp->pagelen < PAGE_SIZE) { | 163 | if (argp->pagelen < PAGE_SIZE) { |
| 164 | argp->end = p + (argp->pagelen>>2); | 164 | argp->end = argp->p + (argp->pagelen>>2); |
| 165 | argp->pagelen = 0; | 165 | argp->pagelen = 0; |
| 166 | } else { | 166 | } else { |
| 167 | argp->end = p + (PAGE_SIZE>>2); | 167 | argp->end = argp->p + (PAGE_SIZE>>2); |
| 168 | argp->pagelen -= PAGE_SIZE; | 168 | argp->pagelen -= PAGE_SIZE; |
| 169 | } | 169 | } |
| 170 | memcpy(((char*)p)+avail, argp->p, (nbytes - avail)); | 170 | memcpy(((char*)p)+avail, argp->p, (nbytes - avail)); |
| @@ -1426,10 +1426,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
| 1426 | argp->p = page_address(argp->pagelist[0]); | 1426 | argp->p = page_address(argp->pagelist[0]); |
| 1427 | argp->pagelist++; | 1427 | argp->pagelist++; |
| 1428 | if (argp->pagelen < PAGE_SIZE) { | 1428 | if (argp->pagelen < PAGE_SIZE) { |
| 1429 | argp->end = p + (argp->pagelen>>2); | 1429 | argp->end = argp->p + (argp->pagelen>>2); |
| 1430 | argp->pagelen = 0; | 1430 | argp->pagelen = 0; |
| 1431 | } else { | 1431 | } else { |
| 1432 | argp->end = p + (PAGE_SIZE>>2); | 1432 | argp->end = argp->p + (PAGE_SIZE>>2); |
| 1433 | argp->pagelen -= PAGE_SIZE; | 1433 | argp->pagelen -= PAGE_SIZE; |
| 1434 | } | 1434 | } |
| 1435 | } | 1435 | } |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 7621db800a74..8418fcc0a6ab 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -2909,7 +2909,7 @@ out_no_task: | |||
| 2909 | */ | 2909 | */ |
| 2910 | static const struct pid_entry tid_base_stuff[] = { | 2910 | static const struct pid_entry tid_base_stuff[] = { |
| 2911 | DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations), | 2911 | DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations), |
| 2912 | DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fd_operations), | 2912 | DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations), |
| 2913 | REG("environ", S_IRUSR, proc_environ_operations), | 2913 | REG("environ", S_IRUSR, proc_environ_operations), |
| 2914 | INF("auxv", S_IRUSR, proc_pid_auxv), | 2914 | INF("auxv", S_IRUSR, proc_pid_auxv), |
| 2915 | ONE("status", S_IRUGO, proc_pid_status), | 2915 | ONE("status", S_IRUGO, proc_pid_status), |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 1c4c8f089970..dfa1d67f8fca 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
| @@ -479,6 +479,7 @@ smb_put_super(struct super_block *sb) | |||
| 479 | if (server->conn_pid) | 479 | if (server->conn_pid) |
| 480 | kill_pid(server->conn_pid, SIGTERM, 1); | 480 | kill_pid(server->conn_pid, SIGTERM, 1); |
| 481 | 481 | ||
| 482 | bdi_destroy(&server->bdi); | ||
| 482 | kfree(server->ops); | 483 | kfree(server->ops); |
| 483 | smb_unload_nls(server); | 484 | smb_unload_nls(server); |
| 484 | sb->s_fs_info = NULL; | 485 | sb->s_fs_info = NULL; |
| @@ -525,6 +526,11 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 525 | if (!server) | 526 | if (!server) |
| 526 | goto out_no_server; | 527 | goto out_no_server; |
| 527 | sb->s_fs_info = server; | 528 | sb->s_fs_info = server; |
| 529 | |||
| 530 | if (bdi_setup_and_register(&server->bdi, "smbfs", BDI_CAP_MAP_COPY)) | ||
| 531 | goto out_bdi; | ||
| 532 | |||
| 533 | sb->s_bdi = &server->bdi; | ||
| 528 | 534 | ||
| 529 | server->super_block = sb; | 535 | server->super_block = sb; |
| 530 | server->mnt = NULL; | 536 | server->mnt = NULL; |
| @@ -624,6 +630,8 @@ out_no_smbiod: | |||
| 624 | out_bad_option: | 630 | out_bad_option: |
| 625 | kfree(mem); | 631 | kfree(mem); |
| 626 | out_no_mem: | 632 | out_no_mem: |
| 633 | bdi_destroy(&server->bdi); | ||
| 634 | out_bdi: | ||
| 627 | if (!server->mnt) | 635 | if (!server->mnt) |
| 628 | printk(KERN_ERR "smb_fill_super: allocation failure\n"); | 636 | printk(KERN_ERR "smb_fill_super: allocation failure\n"); |
| 629 | sb->s_fs_info = NULL; | 637 | sb->s_fs_info = NULL; |
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 1cb0d81b164b..653c030eb840 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c | |||
| @@ -87,9 +87,8 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, | |||
| 87 | u64 cur_index = index >> msblk->devblksize_log2; | 87 | u64 cur_index = index >> msblk->devblksize_log2; |
| 88 | int bytes, compressed, b = 0, k = 0, page = 0, avail; | 88 | int bytes, compressed, b = 0, k = 0, page = 0, avail; |
| 89 | 89 | ||
| 90 | 90 | bh = kcalloc(((srclength + msblk->devblksize - 1) | |
| 91 | bh = kcalloc((msblk->block_size >> msblk->devblksize_log2) + 1, | 91 | >> msblk->devblksize_log2) + 1, sizeof(*bh), GFP_KERNEL); |
| 92 | sizeof(*bh), GFP_KERNEL); | ||
| 93 | if (bh == NULL) | 92 | if (bh == NULL) |
| 94 | return -ENOMEM; | 93 | return -ENOMEM; |
| 95 | 94 | ||
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 3550aec2f655..48b6f4a385a6 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
| @@ -275,7 +275,8 @@ allocate_root: | |||
| 275 | 275 | ||
| 276 | err = squashfs_read_inode(root, root_inode); | 276 | err = squashfs_read_inode(root, root_inode); |
| 277 | if (err) { | 277 | if (err) { |
| 278 | iget_failed(root); | 278 | make_bad_inode(root); |
| 279 | iput(root); | ||
| 279 | goto failed_mount; | 280 | goto failed_mount; |
| 280 | } | 281 | } |
| 281 | insert_inode_hash(root); | 282 | insert_inode_hash(root); |
| @@ -353,6 +354,7 @@ static void squashfs_put_super(struct super_block *sb) | |||
| 353 | kfree(sbi->id_table); | 354 | kfree(sbi->id_table); |
| 354 | kfree(sbi->fragment_index); | 355 | kfree(sbi->fragment_index); |
| 355 | kfree(sbi->meta_index); | 356 | kfree(sbi->meta_index); |
| 357 | kfree(sbi->inode_lookup_table); | ||
| 356 | kfree(sb->s_fs_info); | 358 | kfree(sb->s_fs_info); |
| 357 | sb->s_fs_info = NULL; | 359 | sb->s_fs_info = NULL; |
| 358 | } | 360 | } |
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c index 15a03d0fb9f3..7a603874e483 100644 --- a/fs/squashfs/zlib_wrapper.c +++ b/fs/squashfs/zlib_wrapper.c | |||
| @@ -128,8 +128,9 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, | |||
| 128 | goto release_mutex; | 128 | goto release_mutex; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | length = stream->total_out; | ||
| 131 | mutex_unlock(&msblk->read_data_mutex); | 132 | mutex_unlock(&msblk->read_data_mutex); |
| 132 | return stream->total_out; | 133 | return length; |
| 133 | 134 | ||
| 134 | release_mutex: | 135 | release_mutex: |
| 135 | mutex_unlock(&msblk->read_data_mutex); | 136 | mutex_unlock(&msblk->read_data_mutex); |
diff --git a/fs/super.c b/fs/super.c index f35ac6022109..dc72491a19f9 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -693,6 +693,7 @@ int set_anon_super(struct super_block *s, void *data) | |||
| 693 | return -EMFILE; | 693 | return -EMFILE; |
| 694 | } | 694 | } |
| 695 | s->s_dev = MKDEV(0, dev & MINORMASK); | 695 | s->s_dev = MKDEV(0, dev & MINORMASK); |
| 696 | s->s_bdi = &noop_backing_dev_info; | ||
| 696 | return 0; | 697 | return 0; |
| 697 | } | 698 | } |
| 698 | 699 | ||
| @@ -954,10 +955,11 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | |||
| 954 | if (error < 0) | 955 | if (error < 0) |
| 955 | goto out_free_secdata; | 956 | goto out_free_secdata; |
| 956 | BUG_ON(!mnt->mnt_sb); | 957 | BUG_ON(!mnt->mnt_sb); |
| 958 | WARN_ON(!mnt->mnt_sb->s_bdi); | ||
| 957 | 959 | ||
| 958 | error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); | 960 | error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); |
| 959 | if (error) | 961 | if (error) |
| 960 | goto out_sb; | 962 | goto out_sb; |
| 961 | 963 | ||
| 962 | /* | 964 | /* |
| 963 | * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE | 965 | * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE |
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
| 15 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
| 16 | #include <linux/buffer_head.h> | 16 | #include <linux/buffer_head.h> |
| 17 | #include <linux/backing-dev.h> | ||
| 17 | #include "internal.h" | 18 | #include "internal.h" |
| 18 | 19 | ||
| 19 | #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ | 20 | #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ |
| @@ -32,7 +33,7 @@ static int __sync_filesystem(struct super_block *sb, int wait) | |||
| 32 | * This should be safe, as we require bdi backing to actually | 33 | * This should be safe, as we require bdi backing to actually |
| 33 | * write out data in the first place | 34 | * write out data in the first place |
| 34 | */ | 35 | */ |
| 35 | if (!sb->s_bdi) | 36 | if (!sb->s_bdi || sb->s_bdi == &noop_backing_dev_info) |
| 36 | return 0; | 37 | return 0; |
| 37 | 38 | ||
| 38 | if (sb->s_qcop && sb->s_qcop->quota_sync) | 39 | if (sb->s_qcop && sb->s_qcop->quota_sync) |
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index cd27c9d6c71f..5bba29a07812 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c | |||
| @@ -177,16 +177,26 @@ xfs_swap_extents_check_format( | |||
| 177 | XFS_IFORK_NEXTENTS(ip, XFS_DATA_FORK) > tip->i_df.if_ext_max) | 177 | XFS_IFORK_NEXTENTS(ip, XFS_DATA_FORK) > tip->i_df.if_ext_max) |
| 178 | return EINVAL; | 178 | return EINVAL; |
| 179 | 179 | ||
| 180 | /* Check root block of temp in btree form to max in target */ | 180 | /* |
| 181 | * If we are in a btree format, check that the temp root block will fit | ||
| 182 | * in the target and that it has enough extents to be in btree format | ||
| 183 | * in the target. | ||
| 184 | * | ||
| 185 | * Note that we have to be careful to allow btree->extent conversions | ||
| 186 | * (a common defrag case) which will occur when the temp inode is in | ||
| 187 | * extent format... | ||
| 188 | */ | ||
| 181 | if (tip->i_d.di_format == XFS_DINODE_FMT_BTREE && | 189 | if (tip->i_d.di_format == XFS_DINODE_FMT_BTREE && |
| 182 | XFS_IFORK_BOFF(ip) && | 190 | ((XFS_IFORK_BOFF(ip) && |
| 183 | tip->i_df.if_broot_bytes > XFS_IFORK_BOFF(ip)) | 191 | tip->i_df.if_broot_bytes > XFS_IFORK_BOFF(ip)) || |
| 192 | XFS_IFORK_NEXTENTS(tip, XFS_DATA_FORK) <= ip->i_df.if_ext_max)) | ||
| 184 | return EINVAL; | 193 | return EINVAL; |
| 185 | 194 | ||
| 186 | /* Check root block of target in btree form to max in temp */ | 195 | /* Reciprocal target->temp btree format checks */ |
| 187 | if (ip->i_d.di_format == XFS_DINODE_FMT_BTREE && | 196 | if (ip->i_d.di_format == XFS_DINODE_FMT_BTREE && |
| 188 | XFS_IFORK_BOFF(tip) && | 197 | ((XFS_IFORK_BOFF(tip) && |
| 189 | ip->i_df.if_broot_bytes > XFS_IFORK_BOFF(tip)) | 198 | ip->i_df.if_broot_bytes > XFS_IFORK_BOFF(tip)) || |
| 199 | XFS_IFORK_NEXTENTS(ip, XFS_DATA_FORK) <= tip->i_df.if_ext_max)) | ||
| 190 | return EINVAL; | 200 | return EINVAL; |
| 191 | 201 | ||
| 192 | return 0; | 202 | return 0; |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index fcbc26af00e4..bd0e3c6f323f 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -101,6 +101,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
| 101 | const char *fmt, ...); | 101 | const char *fmt, ...); |
| 102 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 102 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 103 | void bdi_unregister(struct backing_dev_info *bdi); | 103 | void bdi_unregister(struct backing_dev_info *bdi); |
| 104 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | ||
| 104 | void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, | 105 | void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, |
| 105 | long nr_pages); | 106 | long nr_pages); |
| 106 | int bdi_writeback_task(struct bdi_writeback *wb); | 107 | int bdi_writeback_task(struct bdi_writeback *wb); |
| @@ -246,6 +247,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | |||
| 246 | #endif | 247 | #endif |
| 247 | 248 | ||
| 248 | extern struct backing_dev_info default_backing_dev_info; | 249 | extern struct backing_dev_info default_backing_dev_info; |
| 250 | extern struct backing_dev_info noop_backing_dev_info; | ||
| 249 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); | 251 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); |
| 250 | 252 | ||
| 251 | int writeback_in_progress(struct backing_dev_info *bdi); | 253 | int writeback_in_progress(struct backing_dev_info *bdi); |
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 5b5d4731f956..8859e2ede9fe 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #define MAX_CODADEVS 5 /* how many do we allow */ | 7 | #define MAX_CODADEVS 5 /* how many do we allow */ |
| 8 | 8 | ||
| 9 | #ifdef __KERNEL__ | 9 | #ifdef __KERNEL__ |
| 10 | #include <linux/backing-dev.h> | ||
| 11 | |||
| 10 | struct kstatfs; | 12 | struct kstatfs; |
| 11 | 13 | ||
| 12 | /* communication pending/processing queues */ | 14 | /* communication pending/processing queues */ |
| @@ -17,6 +19,7 @@ struct venus_comm { | |||
| 17 | struct list_head vc_processing; | 19 | struct list_head vc_processing; |
| 18 | int vc_inuse; | 20 | int vc_inuse; |
| 19 | struct super_block *vc_sb; | 21 | struct super_block *vc_sb; |
| 22 | struct backing_dev_info bdi; | ||
| 20 | }; | 23 | }; |
| 21 | 24 | ||
| 22 | 25 | ||
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index 6330fc76b00f..5ec9ca671687 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/ncp_mount.h> | 12 | #include <linux/ncp_mount.h> |
| 13 | #include <linux/net.h> | 13 | #include <linux/net.h> |
| 14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
| 15 | #include <linux/backing-dev.h> | ||
| 15 | 16 | ||
| 16 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
| 17 | 18 | ||
| @@ -127,6 +128,7 @@ struct ncp_server { | |||
| 127 | size_t len; | 128 | size_t len; |
| 128 | __u8 data[128]; | 129 | __u8 data[128]; |
| 129 | } unexpected_packet; | 130 | } unexpected_packet; |
| 131 | struct backing_dev_info bdi; | ||
| 130 | }; | 132 | }; |
| 131 | 133 | ||
| 132 | extern void ncp_tcp_rcv_proc(struct work_struct *work); | 134 | extern void ncp_tcp_rcv_proc(struct work_struct *work); |
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 8a060a7040d8..bb947dd1fba9 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #define _SMB_FS_SB | 10 | #define _SMB_FS_SB |
| 11 | 11 | ||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <linux/backing-dev.h> | ||
| 13 | #include <linux/smb.h> | 14 | #include <linux/smb.h> |
| 14 | 15 | ||
| 15 | /* | 16 | /* |
| @@ -74,6 +75,8 @@ struct smb_sb_info { | |||
| 74 | struct smb_ops *ops; | 75 | struct smb_ops *ops; |
| 75 | 76 | ||
| 76 | struct super_block *super_block; | 77 | struct super_block *super_block; |
| 78 | |||
| 79 | struct backing_dev_info bdi; | ||
| 77 | }; | 80 | }; |
| 78 | 81 | ||
| 79 | static inline int | 82 | static inline int |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index 8be5135ff7aa..2c55a7ea20af 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
| @@ -107,6 +107,7 @@ typedef enum { | |||
| 107 | SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ | 107 | SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ |
| 108 | SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ | 108 | SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ |
| 109 | SCTP_CMD_SEND_MSG, /* Send the whole use message */ | 109 | SCTP_CMD_SEND_MSG, /* Send the whole use message */ |
| 110 | SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */ | ||
| 110 | SCTP_CMD_LAST | 111 | SCTP_CMD_LAST |
| 111 | } sctp_verb_t; | 112 | } sctp_verb_t; |
| 112 | 113 | ||
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 78740ec57d5d..fa6cde578a1d 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t); | |||
| 128 | int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); | 128 | int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); |
| 129 | int sctp_inet_listen(struct socket *sock, int backlog); | 129 | int sctp_inet_listen(struct socket *sock, int backlog); |
| 130 | void sctp_write_space(struct sock *sk); | 130 | void sctp_write_space(struct sock *sk); |
| 131 | void sctp_data_ready(struct sock *sk, int len); | ||
| 131 | unsigned int sctp_poll(struct file *file, struct socket *sock, | 132 | unsigned int sctp_poll(struct file *file, struct socket *sock, |
| 132 | poll_table *wait); | 133 | poll_table *wait); |
| 133 | void sctp_sock_rfree(struct sk_buff *skb); | 134 | void sctp_sock_rfree(struct sk_buff *skb); |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index d57847f2f6c1..aab3c13dc310 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
| 27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
| 28 | #include <pcmcia/ss.h> | 28 | #include <pcmcia/ss.h> |
| 29 | #include <asm/atomic.h> | ||
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| 31 | * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus | 32 | * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus |
| @@ -94,10 +95,8 @@ struct pcmcia_device { | |||
| 94 | config_req_t conf; | 95 | config_req_t conf; |
| 95 | window_handle_t win; | 96 | window_handle_t win; |
| 96 | 97 | ||
| 97 | /* Is the device suspended, or in the process of | 98 | /* Is the device suspended? */ |
| 98 | * being removed? */ | ||
| 99 | u16 suspended:1; | 99 | u16 suspended:1; |
| 100 | u16 _removed:1; | ||
| 101 | 100 | ||
| 102 | /* Flags whether io, irq, win configurations were | 101 | /* Flags whether io, irq, win configurations were |
| 103 | * requested, and whether the configuration is "locked" */ | 102 | * requested, and whether the configuration is "locked" */ |
| @@ -115,7 +114,7 @@ struct pcmcia_device { | |||
| 115 | u16 has_card_id:1; | 114 | u16 has_card_id:1; |
| 116 | u16 has_func_id:1; | 115 | u16 has_func_id:1; |
| 117 | 116 | ||
| 118 | u16 reserved:3; | 117 | u16 reserved:4; |
| 119 | 118 | ||
| 120 | u8 func_id; | 119 | u8 func_id; |
| 121 | u16 manf_id; | 120 | u16 manf_id; |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 2e488b60bc76..344705cb42f4 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
| @@ -224,18 +224,16 @@ struct pcmcia_socket { | |||
| 224 | 224 | ||
| 225 | /* 16-bit state: */ | 225 | /* 16-bit state: */ |
| 226 | struct { | 226 | struct { |
| 227 | /* PCMCIA card is present in socket */ | ||
| 228 | u8 present:1; | ||
| 229 | /* "master" ioctl is used */ | 227 | /* "master" ioctl is used */ |
| 230 | u8 busy:1; | 228 | u8 busy:1; |
| 231 | /* pcmcia module is being unloaded */ | ||
| 232 | u8 dead:1; | ||
| 233 | /* the PCMCIA card consists of two pseudo devices */ | 229 | /* the PCMCIA card consists of two pseudo devices */ |
| 234 | u8 has_pfc:1; | 230 | u8 has_pfc:1; |
| 235 | 231 | ||
| 236 | u8 reserved:4; | 232 | u8 reserved:6; |
| 237 | } pcmcia_state; | 233 | } pcmcia_state; |
| 238 | 234 | ||
| 235 | /* non-zero if PCMCIA card is present */ | ||
| 236 | atomic_t present; | ||
| 239 | 237 | ||
| 240 | #ifdef CONFIG_PCMCIA_IOCTL | 238 | #ifdef CONFIG_PCMCIA_IOCTL |
| 241 | struct user_info_t *user; | 239 | struct user_info_t *user; |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index f13e067e1467..707d0dc6da0f 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | #include <linux/writeback.h> | 11 | #include <linux/writeback.h> |
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | 13 | ||
| 14 | static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0); | ||
| 15 | |||
| 14 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) | 16 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) |
| 15 | { | 17 | { |
| 16 | } | 18 | } |
| @@ -25,6 +27,11 @@ struct backing_dev_info default_backing_dev_info = { | |||
| 25 | }; | 27 | }; |
| 26 | EXPORT_SYMBOL_GPL(default_backing_dev_info); | 28 | EXPORT_SYMBOL_GPL(default_backing_dev_info); |
| 27 | 29 | ||
| 30 | struct backing_dev_info noop_backing_dev_info = { | ||
| 31 | .name = "noop", | ||
| 32 | }; | ||
| 33 | EXPORT_SYMBOL_GPL(noop_backing_dev_info); | ||
| 34 | |||
| 28 | static struct class *bdi_class; | 35 | static struct class *bdi_class; |
| 29 | 36 | ||
| 30 | /* | 37 | /* |
| @@ -715,6 +722,33 @@ void bdi_destroy(struct backing_dev_info *bdi) | |||
| 715 | } | 722 | } |
| 716 | EXPORT_SYMBOL(bdi_destroy); | 723 | EXPORT_SYMBOL(bdi_destroy); |
| 717 | 724 | ||
| 725 | /* | ||
| 726 | * For use from filesystems to quickly init and register a bdi associated | ||
| 727 | * with dirty writeback | ||
| 728 | */ | ||
| 729 | int bdi_setup_and_register(struct backing_dev_info *bdi, char *name, | ||
| 730 | unsigned int cap) | ||
| 731 | { | ||
| 732 | char tmp[32]; | ||
| 733 | int err; | ||
| 734 | |||
| 735 | bdi->name = name; | ||
| 736 | bdi->capabilities = cap; | ||
| 737 | err = bdi_init(bdi); | ||
| 738 | if (err) | ||
| 739 | return err; | ||
| 740 | |||
| 741 | sprintf(tmp, "%.28s%s", name, "-%d"); | ||
| 742 | err = bdi_register(bdi, NULL, tmp, atomic_long_inc_return(&bdi_seq)); | ||
| 743 | if (err) { | ||
| 744 | bdi_destroy(bdi); | ||
| 745 | return err; | ||
| 746 | } | ||
| 747 | |||
| 748 | return 0; | ||
| 749 | } | ||
| 750 | EXPORT_SYMBOL(bdi_setup_and_register); | ||
| 751 | |||
| 718 | static wait_queue_head_t congestion_wqh[2] = { | 752 | static wait_queue_head_t congestion_wqh[2] = { |
| 719 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), | 753 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), |
| 720 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) | 754 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) |
| @@ -1977,7 +1977,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, | |||
| 1977 | return 0; | 1977 | return 0; |
| 1978 | 1978 | ||
| 1979 | /* Clean everything up if vma_adjust failed. */ | 1979 | /* Clean everything up if vma_adjust failed. */ |
| 1980 | new->vm_ops->close(new); | 1980 | if (new->vm_ops && new->vm_ops->close) |
| 1981 | new->vm_ops->close(new); | ||
| 1981 | if (new->vm_file) { | 1982 | if (new->vm_file) { |
| 1982 | if (vma->vm_flags & VM_EXECUTABLE) | 1983 | if (vma->vm_flags & VM_EXECUTABLE) |
| 1983 | removed_exe_file_vma(mm); | 1984 | removed_exe_file_vma(mm); |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 99d68c34e4f1..9753b690a8b3 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -1626,7 +1626,10 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
| 1626 | /* Connectionless channel */ | 1626 | /* Connectionless channel */ |
| 1627 | if (sk->sk_type == SOCK_DGRAM) { | 1627 | if (sk->sk_type == SOCK_DGRAM) { |
| 1628 | skb = l2cap_create_connless_pdu(sk, msg, len); | 1628 | skb = l2cap_create_connless_pdu(sk, msg, len); |
| 1629 | err = l2cap_do_send(sk, skb); | 1629 | if (IS_ERR(skb)) |
| 1630 | err = PTR_ERR(skb); | ||
| 1631 | else | ||
| 1632 | err = l2cap_do_send(sk, skb); | ||
| 1630 | goto done; | 1633 | goto done; |
| 1631 | } | 1634 | } |
| 1632 | 1635 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 386c15369d91..eaa0e1bae49b 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -957,9 +957,6 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, | |||
| 957 | unsigned offset; | 957 | unsigned offset; |
| 958 | int err; | 958 | int err; |
| 959 | 959 | ||
| 960 | BR_INPUT_SKB_CB(skb)->igmp = 0; | ||
| 961 | BR_INPUT_SKB_CB(skb)->mrouters_only = 0; | ||
| 962 | |||
| 963 | /* We treat OOM as packet loss for now. */ | 960 | /* We treat OOM as packet loss for now. */ |
| 964 | if (!pskb_may_pull(skb, sizeof(*iph))) | 961 | if (!pskb_may_pull(skb, sizeof(*iph))) |
| 965 | return -EINVAL; | 962 | return -EINVAL; |
| @@ -1049,6 +1046,9 @@ err_out: | |||
| 1049 | int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, | 1046 | int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, |
| 1050 | struct sk_buff *skb) | 1047 | struct sk_buff *skb) |
| 1051 | { | 1048 | { |
| 1049 | BR_INPUT_SKB_CB(skb)->igmp = 0; | ||
| 1050 | BR_INPUT_SKB_CB(skb)->mrouters_only = 0; | ||
| 1051 | |||
| 1052 | if (br->multicast_disabled) | 1052 | if (br->multicast_disabled) |
| 1053 | return 0; | 1053 | return 0; |
| 1054 | 1054 | ||
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index c7da600750bb..93c91b633a56 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c | |||
| @@ -151,6 +151,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
| 151 | dev_load(sock_net(sk), ifr.ifr_name); | 151 | dev_load(sock_net(sk), ifr.ifr_name); |
| 152 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); | 152 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); |
| 153 | 153 | ||
| 154 | if (!dev) | ||
| 155 | return -ENODEV; | ||
| 156 | |||
| 154 | if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl) | 157 | if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl) |
| 155 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); | 158 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); |
| 156 | 159 | ||
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 14825eb09770..8da6429269dd 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -70,17 +70,13 @@ int inet_csk_bind_conflict(const struct sock *sk, | |||
| 70 | (!sk->sk_bound_dev_if || | 70 | (!sk->sk_bound_dev_if || |
| 71 | !sk2->sk_bound_dev_if || | 71 | !sk2->sk_bound_dev_if || |
| 72 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { | 72 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { |
| 73 | const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | ||
| 74 | |||
| 75 | if (!reuse || !sk2->sk_reuse || | 73 | if (!reuse || !sk2->sk_reuse || |
| 76 | sk2->sk_state == TCP_LISTEN) { | 74 | sk2->sk_state == TCP_LISTEN) { |
| 75 | const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | ||
| 77 | if (!sk2_rcv_saddr || !sk_rcv_saddr || | 76 | if (!sk2_rcv_saddr || !sk_rcv_saddr || |
| 78 | sk2_rcv_saddr == sk_rcv_saddr) | 77 | sk2_rcv_saddr == sk_rcv_saddr) |
| 79 | break; | 78 | break; |
| 80 | } else if (reuse && sk2->sk_reuse && | 79 | } |
| 81 | sk2_rcv_saddr && | ||
| 82 | sk2_rcv_saddr == sk_rcv_saddr) | ||
| 83 | break; | ||
| 84 | } | 80 | } |
| 85 | } | 81 | } |
| 86 | return node != NULL; | 82 | return node != NULL; |
| @@ -124,11 +120,9 @@ again: | |||
| 124 | smallest_size = tb->num_owners; | 120 | smallest_size = tb->num_owners; |
| 125 | smallest_rover = rover; | 121 | smallest_rover = rover; |
| 126 | if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { | 122 | if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { |
| 127 | if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) { | 123 | spin_unlock(&head->lock); |
| 128 | spin_unlock(&head->lock); | 124 | snum = smallest_rover; |
| 129 | snum = smallest_rover; | 125 | goto have_snum; |
| 130 | goto have_snum; | ||
| 131 | } | ||
| 132 | } | 126 | } |
| 133 | } | 127 | } |
| 134 | goto next; | 128 | goto next; |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 3a4d92b5a83e..628db24bcf22 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
| @@ -42,16 +42,11 @@ int inet6_csk_bind_conflict(const struct sock *sk, | |||
| 42 | if (sk != sk2 && | 42 | if (sk != sk2 && |
| 43 | (!sk->sk_bound_dev_if || | 43 | (!sk->sk_bound_dev_if || |
| 44 | !sk2->sk_bound_dev_if || | 44 | !sk2->sk_bound_dev_if || |
| 45 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { | 45 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if) && |
| 46 | if ((!sk->sk_reuse || !sk2->sk_reuse || | 46 | (!sk->sk_reuse || !sk2->sk_reuse || |
| 47 | sk2->sk_state == TCP_LISTEN) && | 47 | sk2->sk_state == TCP_LISTEN) && |
| 48 | ipv6_rcv_saddr_equal(sk, sk2)) | 48 | ipv6_rcv_saddr_equal(sk, sk2)) |
| 49 | break; | 49 | break; |
| 50 | else if (sk->sk_reuse && sk2->sk_reuse && | ||
| 51 | !ipv6_addr_any(inet6_rcv_saddr(sk)) && | ||
| 52 | ipv6_rcv_saddr_equal(sk, sk2)) | ||
| 53 | break; | ||
| 54 | } | ||
| 55 | } | 50 | } |
| 56 | 51 | ||
| 57 | return node != NULL; | 52 | return node != NULL; |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index df5abbff63e2..99c93ee98ad9 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
| @@ -1194,8 +1194,10 @@ void sctp_assoc_update(struct sctp_association *asoc, | |||
| 1194 | /* Remove any peer addresses not present in the new association. */ | 1194 | /* Remove any peer addresses not present in the new association. */ |
| 1195 | list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { | 1195 | list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { |
| 1196 | trans = list_entry(pos, struct sctp_transport, transports); | 1196 | trans = list_entry(pos, struct sctp_transport, transports); |
| 1197 | if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) | 1197 | if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) { |
| 1198 | sctp_assoc_del_peer(asoc, &trans->ipaddr); | 1198 | sctp_assoc_rm_peer(asoc, trans); |
| 1199 | continue; | ||
| 1200 | } | ||
| 1199 | 1201 | ||
| 1200 | if (asoc->state >= SCTP_STATE_ESTABLISHED) | 1202 | if (asoc->state >= SCTP_STATE_ESTABLISHED) |
| 1201 | sctp_transport_reset(trans); | 1203 | sctp_transport_reset(trans); |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 905fda582b92..7ec09ba03a1c 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
| @@ -144,6 +144,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
| 144 | /* Use SCTP specific send buffer space queues. */ | 144 | /* Use SCTP specific send buffer space queues. */ |
| 145 | ep->sndbuf_policy = sctp_sndbuf_policy; | 145 | ep->sndbuf_policy = sctp_sndbuf_policy; |
| 146 | 146 | ||
| 147 | sk->sk_data_ready = sctp_data_ready; | ||
| 147 | sk->sk_write_space = sctp_write_space; | 148 | sk->sk_write_space = sctp_write_space; |
| 148 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); | 149 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); |
| 149 | 150 | ||
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 17cb400ecd6a..0fd5b4c88358 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
| @@ -208,7 +208,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
| 208 | sp = sctp_sk(asoc->base.sk); | 208 | sp = sctp_sk(asoc->base.sk); |
| 209 | num_types = sp->pf->supported_addrs(sp, types); | 209 | num_types = sp->pf->supported_addrs(sp, types); |
| 210 | 210 | ||
| 211 | chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); | 211 | chunksize = sizeof(init) + addrs_len; |
| 212 | chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types)); | ||
| 212 | chunksize += sizeof(ecap_param); | 213 | chunksize += sizeof(ecap_param); |
| 213 | 214 | ||
| 214 | if (sctp_prsctp_enable) | 215 | if (sctp_prsctp_enable) |
| @@ -238,14 +239,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
| 238 | /* Add HMACS parameter length if any were defined */ | 239 | /* Add HMACS parameter length if any were defined */ |
| 239 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; | 240 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; |
| 240 | if (auth_hmacs->length) | 241 | if (auth_hmacs->length) |
| 241 | chunksize += ntohs(auth_hmacs->length); | 242 | chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); |
| 242 | else | 243 | else |
| 243 | auth_hmacs = NULL; | 244 | auth_hmacs = NULL; |
| 244 | 245 | ||
| 245 | /* Add CHUNKS parameter length */ | 246 | /* Add CHUNKS parameter length */ |
| 246 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; | 247 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; |
| 247 | if (auth_chunks->length) | 248 | if (auth_chunks->length) |
| 248 | chunksize += ntohs(auth_chunks->length); | 249 | chunksize += WORD_ROUND(ntohs(auth_chunks->length)); |
| 249 | else | 250 | else |
| 250 | auth_chunks = NULL; | 251 | auth_chunks = NULL; |
| 251 | 252 | ||
| @@ -255,7 +256,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
| 255 | 256 | ||
| 256 | /* If we have any extensions to report, account for that */ | 257 | /* If we have any extensions to report, account for that */ |
| 257 | if (num_ext) | 258 | if (num_ext) |
| 258 | chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; | 259 | chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + |
| 260 | num_ext); | ||
| 259 | 261 | ||
| 260 | /* RFC 2960 3.3.2 Initiation (INIT) (1) | 262 | /* RFC 2960 3.3.2 Initiation (INIT) (1) |
| 261 | * | 263 | * |
| @@ -397,13 +399,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
| 397 | 399 | ||
| 398 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; | 400 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; |
| 399 | if (auth_hmacs->length) | 401 | if (auth_hmacs->length) |
| 400 | chunksize += ntohs(auth_hmacs->length); | 402 | chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); |
| 401 | else | 403 | else |
| 402 | auth_hmacs = NULL; | 404 | auth_hmacs = NULL; |
| 403 | 405 | ||
| 404 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; | 406 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; |
| 405 | if (auth_chunks->length) | 407 | if (auth_chunks->length) |
| 406 | chunksize += ntohs(auth_chunks->length); | 408 | chunksize += WORD_ROUND(ntohs(auth_chunks->length)); |
| 407 | else | 409 | else |
| 408 | auth_chunks = NULL; | 410 | auth_chunks = NULL; |
| 409 | 411 | ||
| @@ -412,7 +414,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
| 412 | } | 414 | } |
| 413 | 415 | ||
| 414 | if (num_ext) | 416 | if (num_ext) |
| 415 | chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; | 417 | chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + |
| 418 | num_ext); | ||
| 416 | 419 | ||
| 417 | /* Now allocate and fill out the chunk. */ | 420 | /* Now allocate and fill out the chunk. */ |
| 418 | retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); | 421 | retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); |
| @@ -3315,21 +3318,6 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
| 3315 | sctp_chunk_free(asconf); | 3318 | sctp_chunk_free(asconf); |
| 3316 | asoc->addip_last_asconf = NULL; | 3319 | asoc->addip_last_asconf = NULL; |
| 3317 | 3320 | ||
| 3318 | /* Send the next asconf chunk from the addip chunk queue. */ | ||
| 3319 | if (!list_empty(&asoc->addip_chunk_list)) { | ||
| 3320 | struct list_head *entry = asoc->addip_chunk_list.next; | ||
| 3321 | asconf = list_entry(entry, struct sctp_chunk, list); | ||
| 3322 | |||
| 3323 | list_del_init(entry); | ||
| 3324 | |||
| 3325 | /* Hold the chunk until an ASCONF_ACK is received. */ | ||
| 3326 | sctp_chunk_hold(asconf); | ||
| 3327 | if (sctp_primitive_ASCONF(asoc, asconf)) | ||
| 3328 | sctp_chunk_free(asconf); | ||
| 3329 | else | ||
| 3330 | asoc->addip_last_asconf = asconf; | ||
| 3331 | } | ||
| 3332 | |||
| 3333 | return retval; | 3321 | return retval; |
| 3334 | } | 3322 | } |
| 3335 | 3323 | ||
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 4c5bed9af4e3..d5ae450b6f02 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
| @@ -962,6 +962,29 @@ static int sctp_cmd_send_msg(struct sctp_association *asoc, | |||
| 962 | } | 962 | } |
| 963 | 963 | ||
| 964 | 964 | ||
| 965 | /* Sent the next ASCONF packet currently stored in the association. | ||
| 966 | * This happens after the ASCONF_ACK was succeffully processed. | ||
| 967 | */ | ||
| 968 | static void sctp_cmd_send_asconf(struct sctp_association *asoc) | ||
| 969 | { | ||
| 970 | /* Send the next asconf chunk from the addip chunk | ||
| 971 | * queue. | ||
| 972 | */ | ||
| 973 | if (!list_empty(&asoc->addip_chunk_list)) { | ||
| 974 | struct list_head *entry = asoc->addip_chunk_list.next; | ||
| 975 | struct sctp_chunk *asconf = list_entry(entry, | ||
| 976 | struct sctp_chunk, list); | ||
| 977 | list_del_init(entry); | ||
| 978 | |||
| 979 | /* Hold the chunk until an ASCONF_ACK is received. */ | ||
| 980 | sctp_chunk_hold(asconf); | ||
| 981 | if (sctp_primitive_ASCONF(asoc, asconf)) | ||
| 982 | sctp_chunk_free(asconf); | ||
| 983 | else | ||
| 984 | asoc->addip_last_asconf = asconf; | ||
| 985 | } | ||
| 986 | } | ||
| 987 | |||
| 965 | 988 | ||
| 966 | /* These three macros allow us to pull the debugging code out of the | 989 | /* These three macros allow us to pull the debugging code out of the |
| 967 | * main flow of sctp_do_sm() to keep attention focused on the real | 990 | * main flow of sctp_do_sm() to keep attention focused on the real |
| @@ -1617,6 +1640,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
| 1617 | } | 1640 | } |
| 1618 | error = sctp_cmd_send_msg(asoc, cmd->obj.msg); | 1641 | error = sctp_cmd_send_msg(asoc, cmd->obj.msg); |
| 1619 | break; | 1642 | break; |
| 1643 | case SCTP_CMD_SEND_NEXT_ASCONF: | ||
| 1644 | sctp_cmd_send_asconf(asoc); | ||
| 1645 | break; | ||
| 1620 | default: | 1646 | default: |
| 1621 | printk(KERN_WARNING "Impossible command: %u, %p\n", | 1647 | printk(KERN_WARNING "Impossible command: %u, %p\n", |
| 1622 | cmd->verb, cmd->obj.ptr); | 1648 | cmd->verb, cmd->obj.ptr); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index abf601a1b847..24b2cd555637 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
| @@ -3676,8 +3676,14 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, | |||
| 3676 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); | 3676 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); |
| 3677 | 3677 | ||
| 3678 | if (!sctp_process_asconf_ack((struct sctp_association *)asoc, | 3678 | if (!sctp_process_asconf_ack((struct sctp_association *)asoc, |
| 3679 | asconf_ack)) | 3679 | asconf_ack)) { |
| 3680 | /* Successfully processed ASCONF_ACK. We can | ||
| 3681 | * release the next asconf if we have one. | ||
| 3682 | */ | ||
| 3683 | sctp_add_cmd_sf(commands, SCTP_CMD_SEND_NEXT_ASCONF, | ||
| 3684 | SCTP_NULL()); | ||
| 3680 | return SCTP_DISPOSITION_CONSUME; | 3685 | return SCTP_DISPOSITION_CONSUME; |
| 3686 | } | ||
| 3681 | 3687 | ||
| 3682 | abort = sctp_make_abort(asoc, asconf_ack, | 3688 | abort = sctp_make_abort(asoc, asconf_ack, |
| 3683 | sizeof(sctp_errhdr_t)); | 3689 | sizeof(sctp_errhdr_t)); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 007e8baba089..44a1ab03a3f0 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -3719,12 +3719,12 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) | |||
| 3719 | sp->hmac = NULL; | 3719 | sp->hmac = NULL; |
| 3720 | 3720 | ||
| 3721 | SCTP_DBG_OBJCNT_INC(sock); | 3721 | SCTP_DBG_OBJCNT_INC(sock); |
| 3722 | percpu_counter_inc(&sctp_sockets_allocated); | ||
| 3723 | 3722 | ||
| 3724 | /* Set socket backlog limit. */ | 3723 | /* Set socket backlog limit. */ |
| 3725 | sk->sk_backlog.limit = sysctl_sctp_rmem[1]; | 3724 | sk->sk_backlog.limit = sysctl_sctp_rmem[1]; |
| 3726 | 3725 | ||
| 3727 | local_bh_disable(); | 3726 | local_bh_disable(); |
| 3727 | percpu_counter_inc(&sctp_sockets_allocated); | ||
| 3728 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | 3728 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
| 3729 | local_bh_enable(); | 3729 | local_bh_enable(); |
| 3730 | 3730 | ||
| @@ -3741,8 +3741,8 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk) | |||
| 3741 | /* Release our hold on the endpoint. */ | 3741 | /* Release our hold on the endpoint. */ |
| 3742 | ep = sctp_sk(sk)->ep; | 3742 | ep = sctp_sk(sk)->ep; |
| 3743 | sctp_endpoint_free(ep); | 3743 | sctp_endpoint_free(ep); |
| 3744 | percpu_counter_dec(&sctp_sockets_allocated); | ||
| 3745 | local_bh_disable(); | 3744 | local_bh_disable(); |
| 3745 | percpu_counter_dec(&sctp_sockets_allocated); | ||
| 3746 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | 3746 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
| 3747 | local_bh_enable(); | 3747 | local_bh_enable(); |
| 3748 | } | 3748 | } |
| @@ -6189,6 +6189,16 @@ do_nonblock: | |||
| 6189 | goto out; | 6189 | goto out; |
| 6190 | } | 6190 | } |
| 6191 | 6191 | ||
| 6192 | void sctp_data_ready(struct sock *sk, int len) | ||
| 6193 | { | ||
| 6194 | read_lock_bh(&sk->sk_callback_lock); | ||
| 6195 | if (sk_has_sleeper(sk)) | ||
| 6196 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN | | ||
| 6197 | POLLRDNORM | POLLRDBAND); | ||
| 6198 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); | ||
| 6199 | read_unlock_bh(&sk->sk_callback_lock); | ||
| 6200 | } | ||
| 6201 | |||
| 6192 | /* If socket sndbuf has changed, wake up all per association waiters. */ | 6202 | /* If socket sndbuf has changed, wake up all per association waiters. */ |
| 6193 | void sctp_write_space(struct sock *sk) | 6203 | void sctp_write_space(struct sock *sk) |
| 6194 | { | 6204 | { |
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index e814d2109f8e..dd7cd0f8e13c 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
| @@ -201,7 +201,7 @@ static long keyring_read(const struct key *keyring, | |||
| 201 | int loop, ret; | 201 | int loop, ret; |
| 202 | 202 | ||
| 203 | ret = 0; | 203 | ret = 0; |
| 204 | klist = rcu_dereference(keyring->payload.subscriptions); | 204 | klist = keyring->payload.subscriptions; |
| 205 | 205 | ||
| 206 | if (klist) { | 206 | if (klist) { |
| 207 | /* calculate how much data we could return */ | 207 | /* calculate how much data we could return */ |
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index ea97c3120d66..d737cea5347c 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
| @@ -339,8 +339,10 @@ static int construct_alloc_key(struct key_type *type, | |||
| 339 | 339 | ||
| 340 | key_already_present: | 340 | key_already_present: |
| 341 | mutex_unlock(&key_construction_mutex); | 341 | mutex_unlock(&key_construction_mutex); |
| 342 | if (dest_keyring) | 342 | if (dest_keyring) { |
| 343 | __key_link(dest_keyring, key_ref_to_ptr(key_ref)); | ||
| 343 | up_write(&dest_keyring->sem); | 344 | up_write(&dest_keyring->sem); |
| 345 | } | ||
| 344 | mutex_unlock(&user->cons_lock); | 346 | mutex_unlock(&user->cons_lock); |
| 345 | key_put(key); | 347 | key_put(key); |
| 346 | *_key = key = key_ref_to_ptr(key_ref); | 348 | *_key = key = key_ref_to_ptr(key_ref); |
| @@ -431,6 +433,11 @@ struct key *request_key_and_link(struct key_type *type, | |||
| 431 | 433 | ||
| 432 | if (!IS_ERR(key_ref)) { | 434 | if (!IS_ERR(key_ref)) { |
| 433 | key = key_ref_to_ptr(key_ref); | 435 | key = key_ref_to_ptr(key_ref); |
| 436 | if (dest_keyring) { | ||
| 437 | construct_get_dest_keyring(&dest_keyring); | ||
| 438 | key_link(dest_keyring, key); | ||
| 439 | key_put(dest_keyring); | ||
| 440 | } | ||
| 434 | } else if (PTR_ERR(key_ref) != -EAGAIN) { | 441 | } else if (PTR_ERR(key_ref) != -EAGAIN) { |
| 435 | key = ERR_CAST(key_ref); | 442 | key = ERR_CAST(key_ref); |
| 436 | } else { | 443 | } else { |
