diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-04-24 14:33:46 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-04-24 14:33:54 -0400 |
commit | 6402c7dc2a19c19bd8cdc7d80878b850da418942 (patch) | |
tree | cda2ea2df40442e2aa016119f3548cc504127ea8 /drivers | |
parent | 77c675ba18836802f6b73d2d773481d06ebc0f04 (diff) | |
parent | 60d509fa6a9c4653a86ad830e4c4b30360b23f0e (diff) |
Merge branch 'linus' into timers/core
Reason: Get upstream fixes before adding conflicting code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers')
518 files changed, 7002 insertions, 4182 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 92ed9692c47e..4bf68c8d4797 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -396,7 +396,7 @@ config ACPI_CUSTOM_METHOD | |||
396 | 396 | ||
397 | config ACPI_BGRT | 397 | config ACPI_BGRT |
398 | bool "Boottime Graphics Resource Table support" | 398 | bool "Boottime Graphics Resource Table support" |
399 | depends on EFI | 399 | depends on EFI && X86 |
400 | help | 400 | help |
401 | This driver adds support for exposing the ACPI Boottime Graphics | 401 | This driver adds support for exposing the ACPI Boottime Graphics |
402 | Resource Table, which allows the operating system to obtain | 402 | Resource Table, which allows the operating system to obtain |
diff --git a/drivers/acpi/acpi_i2c.c b/drivers/acpi/acpi_i2c.c index 82045e3f5cac..a82c7626aa9b 100644 --- a/drivers/acpi/acpi_i2c.c +++ b/drivers/acpi/acpi_i2c.c | |||
@@ -90,7 +90,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adapter) | |||
90 | acpi_handle handle; | 90 | acpi_handle handle; |
91 | acpi_status status; | 91 | acpi_status status; |
92 | 92 | ||
93 | handle = ACPI_HANDLE(&adapter->dev); | 93 | handle = ACPI_HANDLE(adapter->dev.parent); |
94 | if (!handle) | 94 | if (!handle) |
95 | return; | 95 | return; |
96 | 96 | ||
diff --git a/drivers/acpi/apei/cper.c b/drivers/acpi/apei/cper.c index 1e5d8a40101e..fefc2ca7cc3e 100644 --- a/drivers/acpi/apei/cper.c +++ b/drivers/acpi/apei/cper.c | |||
@@ -405,7 +405,7 @@ int apei_estatus_check(const struct acpi_hest_generic_status *estatus) | |||
405 | return rc; | 405 | return rc; |
406 | data_len = estatus->data_length; | 406 | data_len = estatus->data_length; |
407 | gdata = (struct acpi_hest_generic_data *)(estatus + 1); | 407 | gdata = (struct acpi_hest_generic_data *)(estatus + 1); |
408 | while (data_len > sizeof(*gdata)) { | 408 | while (data_len >= sizeof(*gdata)) { |
409 | gedata_len = gdata->error_data_length; | 409 | gedata_len = gdata->error_data_length; |
410 | if (gedata_len > data_len - sizeof(*gdata)) | 410 | if (gedata_len > data_len - sizeof(*gdata)) |
411 | return -EINVAL; | 411 | return -EINVAL; |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 0ac546d5e53f..6ae5e440436e 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -415,7 +415,6 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
415 | struct acpi_pci_root *root; | 415 | struct acpi_pci_root *root; |
416 | struct acpi_pci_driver *driver; | 416 | struct acpi_pci_driver *driver; |
417 | u32 flags, base_flags; | 417 | u32 flags, base_flags; |
418 | bool is_osc_granted = false; | ||
419 | 418 | ||
420 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); | 419 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
421 | if (!root) | 420 | if (!root) |
@@ -476,6 +475,30 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
476 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | 475 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; |
477 | acpi_pci_osc_support(root, flags); | 476 | acpi_pci_osc_support(root, flags); |
478 | 477 | ||
478 | /* | ||
479 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
480 | */ | ||
481 | |||
482 | mutex_lock(&acpi_pci_root_lock); | ||
483 | list_add_tail(&root->node, &acpi_pci_roots); | ||
484 | mutex_unlock(&acpi_pci_root_lock); | ||
485 | |||
486 | /* | ||
487 | * Scan the Root Bridge | ||
488 | * -------------------- | ||
489 | * Must do this prior to any attempt to bind the root device, as the | ||
490 | * PCI namespace does not get created until this call is made (and | ||
491 | * thus the root bridge's pci_dev does not exist). | ||
492 | */ | ||
493 | root->bus = pci_acpi_scan_root(root); | ||
494 | if (!root->bus) { | ||
495 | printk(KERN_ERR PREFIX | ||
496 | "Bus %04x:%02x not present in PCI namespace\n", | ||
497 | root->segment, (unsigned int)root->secondary.start); | ||
498 | result = -ENODEV; | ||
499 | goto out_del_root; | ||
500 | } | ||
501 | |||
479 | /* Indicate support for various _OSC capabilities. */ | 502 | /* Indicate support for various _OSC capabilities. */ |
480 | if (pci_ext_cfg_avail()) | 503 | if (pci_ext_cfg_avail()) |
481 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; | 504 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; |
@@ -494,6 +517,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
494 | flags = base_flags; | 517 | flags = base_flags; |
495 | } | 518 | } |
496 | } | 519 | } |
520 | |||
497 | if (!pcie_ports_disabled | 521 | if (!pcie_ports_disabled |
498 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | 522 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { |
499 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | 523 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
@@ -514,54 +538,28 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
514 | status = acpi_pci_osc_control_set(device->handle, &flags, | 538 | status = acpi_pci_osc_control_set(device->handle, &flags, |
515 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | 539 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); |
516 | if (ACPI_SUCCESS(status)) { | 540 | if (ACPI_SUCCESS(status)) { |
517 | is_osc_granted = true; | ||
518 | dev_info(&device->dev, | 541 | dev_info(&device->dev, |
519 | "ACPI _OSC control (0x%02x) granted\n", flags); | 542 | "ACPI _OSC control (0x%02x) granted\n", flags); |
543 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | ||
544 | /* | ||
545 | * We have ASPM control, but the FADT indicates | ||
546 | * that it's unsupported. Clear it. | ||
547 | */ | ||
548 | pcie_clear_aspm(root->bus); | ||
549 | } | ||
520 | } else { | 550 | } else { |
521 | is_osc_granted = false; | ||
522 | dev_info(&device->dev, | 551 | dev_info(&device->dev, |
523 | "ACPI _OSC request failed (%s), " | 552 | "ACPI _OSC request failed (%s), " |
524 | "returned control mask: 0x%02x\n", | 553 | "returned control mask: 0x%02x\n", |
525 | acpi_format_exception(status), flags); | 554 | acpi_format_exception(status), flags); |
555 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
556 | "disabling ASPM\n"); | ||
557 | pcie_no_aspm(); | ||
526 | } | 558 | } |
527 | } else { | 559 | } else { |
528 | dev_info(&device->dev, | 560 | dev_info(&device->dev, |
529 | "Unable to request _OSC control " | 561 | "Unable to request _OSC control " |
530 | "(_OSC support mask: 0x%02x)\n", flags); | 562 | "(_OSC support mask: 0x%02x)\n", flags); |
531 | } | ||
532 | |||
533 | /* | ||
534 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
535 | */ | ||
536 | |||
537 | mutex_lock(&acpi_pci_root_lock); | ||
538 | list_add_tail(&root->node, &acpi_pci_roots); | ||
539 | mutex_unlock(&acpi_pci_root_lock); | ||
540 | |||
541 | /* | ||
542 | * Scan the Root Bridge | ||
543 | * -------------------- | ||
544 | * Must do this prior to any attempt to bind the root device, as the | ||
545 | * PCI namespace does not get created until this call is made (and | ||
546 | * thus the root bridge's pci_dev does not exist). | ||
547 | */ | ||
548 | root->bus = pci_acpi_scan_root(root); | ||
549 | if (!root->bus) { | ||
550 | printk(KERN_ERR PREFIX | ||
551 | "Bus %04x:%02x not present in PCI namespace\n", | ||
552 | root->segment, (unsigned int)root->secondary.start); | ||
553 | result = -ENODEV; | ||
554 | goto out_del_root; | ||
555 | } | ||
556 | |||
557 | /* ASPM setting */ | ||
558 | if (is_osc_granted) { | ||
559 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) | ||
560 | pcie_clear_aspm(root->bus); | ||
561 | } else { | ||
562 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
563 | "disabling ASPM\n"); | ||
564 | pcie_no_aspm(); | ||
565 | } | 563 | } |
566 | 564 | ||
567 | pci_acpi_add_bus_pm_notifier(device, root->bus); | 565 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
@@ -646,6 +644,7 @@ static void handle_root_bridge_insertion(acpi_handle handle) | |||
646 | 644 | ||
647 | static void handle_root_bridge_removal(struct acpi_device *device) | 645 | static void handle_root_bridge_removal(struct acpi_device *device) |
648 | { | 646 | { |
647 | acpi_status status; | ||
649 | struct acpi_eject_event *ej_event; | 648 | struct acpi_eject_event *ej_event; |
650 | 649 | ||
651 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); | 650 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); |
@@ -661,7 +660,9 @@ static void handle_root_bridge_removal(struct acpi_device *device) | |||
661 | ej_event->device = device; | 660 | ej_event->device = device; |
662 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | 661 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; |
663 | 662 | ||
664 | acpi_bus_hot_remove_device(ej_event); | 663 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event); |
664 | if (ACPI_FAILURE(status)) | ||
665 | kfree(ej_event); | ||
665 | } | 666 | } |
666 | 667 | ||
667 | static void _handle_hotplug_event_root(struct work_struct *work) | 668 | static void _handle_hotplug_event_root(struct work_struct *work) |
@@ -676,8 +677,9 @@ static void _handle_hotplug_event_root(struct work_struct *work) | |||
676 | handle = hp_work->handle; | 677 | handle = hp_work->handle; |
677 | type = hp_work->type; | 678 | type = hp_work->type; |
678 | 679 | ||
679 | root = acpi_pci_find_root(handle); | 680 | acpi_scan_lock_acquire(); |
680 | 681 | ||
682 | root = acpi_pci_find_root(handle); | ||
681 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | 683 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); |
682 | 684 | ||
683 | switch (type) { | 685 | switch (type) { |
@@ -711,6 +713,7 @@ static void _handle_hotplug_event_root(struct work_struct *work) | |||
711 | break; | 713 | break; |
712 | } | 714 | } |
713 | 715 | ||
716 | acpi_scan_lock_release(); | ||
714 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ | 717 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ |
715 | kfree(buffer.pointer); | 718 | kfree(buffer.pointer); |
716 | } | 719 | } |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index fc95308e9a11..ee255c60bdac 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -66,7 +66,8 @@ module_param(latency_factor, uint, 0644); | |||
66 | 66 | ||
67 | static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); | 67 | static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); |
68 | 68 | ||
69 | static struct acpi_processor_cx *acpi_cstate[CPUIDLE_STATE_MAX]; | 69 | static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX], |
70 | acpi_cstate); | ||
70 | 71 | ||
71 | static int disabled_by_idle_boot_param(void) | 72 | static int disabled_by_idle_boot_param(void) |
72 | { | 73 | { |
@@ -722,7 +723,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
722 | struct cpuidle_driver *drv, int index) | 723 | struct cpuidle_driver *drv, int index) |
723 | { | 724 | { |
724 | struct acpi_processor *pr; | 725 | struct acpi_processor *pr; |
725 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 726 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
726 | 727 | ||
727 | pr = __this_cpu_read(processors); | 728 | pr = __this_cpu_read(processors); |
728 | 729 | ||
@@ -745,7 +746,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
745 | */ | 746 | */ |
746 | static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) | 747 | static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) |
747 | { | 748 | { |
748 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 749 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
749 | 750 | ||
750 | ACPI_FLUSH_CPU_CACHE(); | 751 | ACPI_FLUSH_CPU_CACHE(); |
751 | 752 | ||
@@ -775,7 +776,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
775 | struct cpuidle_driver *drv, int index) | 776 | struct cpuidle_driver *drv, int index) |
776 | { | 777 | { |
777 | struct acpi_processor *pr; | 778 | struct acpi_processor *pr; |
778 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 779 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
779 | 780 | ||
780 | pr = __this_cpu_read(processors); | 781 | pr = __this_cpu_read(processors); |
781 | 782 | ||
@@ -833,7 +834,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
833 | struct cpuidle_driver *drv, int index) | 834 | struct cpuidle_driver *drv, int index) |
834 | { | 835 | { |
835 | struct acpi_processor *pr; | 836 | struct acpi_processor *pr; |
836 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 837 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
837 | 838 | ||
838 | pr = __this_cpu_read(processors); | 839 | pr = __this_cpu_read(processors); |
839 | 840 | ||
@@ -960,7 +961,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, | |||
960 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | 961 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) |
961 | continue; | 962 | continue; |
962 | #endif | 963 | #endif |
963 | acpi_cstate[count] = cx; | 964 | per_cpu(acpi_cstate[count], dev->cpu) = cx; |
964 | 965 | ||
965 | count++; | 966 | count++; |
966 | if (count == CPUIDLE_STATE_MAX) | 967 | if (count == CPUIDLE_STATE_MAX) |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 53e7ac9403a7..e854582f29a6 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -465,7 +465,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
465 | return result; | 465 | return result; |
466 | } | 466 | } |
467 | 467 | ||
468 | static int acpi_processor_get_performance_info(struct acpi_processor *pr) | 468 | int acpi_processor_get_performance_info(struct acpi_processor *pr) |
469 | { | 469 | { |
470 | int result = 0; | 470 | int result = 0; |
471 | acpi_status status = AE_OK; | 471 | acpi_status status = AE_OK; |
@@ -509,7 +509,7 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
509 | #endif | 509 | #endif |
510 | return result; | 510 | return result; |
511 | } | 511 | } |
512 | 512 | EXPORT_SYMBOL_GPL(acpi_processor_get_performance_info); | |
513 | int acpi_processor_notify_smm(struct module *calling_module) | 513 | int acpi_processor_notify_smm(struct module *calling_module) |
514 | { | 514 | { |
515 | acpi_status status; | 515 | acpi_status status; |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 24213033fbae..9c1a435d10e6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -193,6 +193,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
193 | }, | 193 | }, |
194 | { | 194 | { |
195 | .callback = init_nvs_nosave, | 195 | .callback = init_nvs_nosave, |
196 | .ident = "Sony Vaio VGN-FW21M", | ||
197 | .matches = { | ||
198 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
199 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21M"), | ||
200 | }, | ||
201 | }, | ||
202 | { | ||
203 | .callback = init_nvs_nosave, | ||
196 | .ident = "Sony Vaio VPCEB17FX", | 204 | .ident = "Sony Vaio VPCEB17FX", |
197 | .matches = { | 205 | .matches = { |
198 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | 206 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index 093c43554963..1f44e56cc65d 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c | |||
@@ -158,7 +158,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn) | |||
158 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); | 158 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | #ifdef CONFIG_PM_SLEEP | 161 | #ifdef CONFIG_PM |
162 | static int tegra_ahb_suspend(struct device *dev) | 162 | static int tegra_ahb_suspend(struct device *dev) |
163 | { | 163 | { |
164 | int i; | 164 | int i; |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 3e751b74615e..a5a3ebcbdd2c 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -59,15 +59,16 @@ config ATA_ACPI | |||
59 | option libata.noacpi=1 | 59 | option libata.noacpi=1 |
60 | 60 | ||
61 | config SATA_ZPODD | 61 | config SATA_ZPODD |
62 | bool "SATA Zero Power ODD Support" | 62 | bool "SATA Zero Power Optical Disc Drive (ZPODD) support" |
63 | depends on ATA_ACPI | 63 | depends on ATA_ACPI |
64 | default n | 64 | default n |
65 | help | 65 | help |
66 | This option adds support for SATA ZPODD. It requires both | 66 | This option adds support for SATA Zero Power Optical Disc |
67 | ODD and the platform support, and if enabled, will automatically | 67 | Drive (ZPODD). It requires both the ODD and the platform |
68 | power on/off the ODD when certain condition is satisfied. This | 68 | support, and if enabled, will automatically power on/off the |
69 | does not impact user's experience of the ODD, only power is saved | 69 | ODD when certain condition is satisfied. This does not impact |
70 | when ODD is not in use(i.e. no disc inside). | 70 | end user's experience of the ODD, only power is saved when |
71 | the ODD is not in use (i.e. no disc inside). | ||
71 | 72 | ||
72 | If unsure, say N. | 73 | If unsure, say N. |
73 | 74 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a99112cfd8b1..6a67b07de494 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -281,6 +281,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
281 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ | 281 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ |
282 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ | 282 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ |
283 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ | 283 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ |
284 | { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Wellsburg RAID */ | ||
285 | { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Wellsburg RAID */ | ||
284 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ | 286 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ |
285 | { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ | 287 | { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ |
286 | { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ | 288 | { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index d2ba439cfe54..2f48123d74c4 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -150,6 +150,7 @@ enum piix_controller_ids { | |||
150 | tolapai_sata, | 150 | tolapai_sata, |
151 | piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */ | 151 | piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */ |
152 | ich8_sata_snb, | 152 | ich8_sata_snb, |
153 | ich8_2port_sata_snb, | ||
153 | }; | 154 | }; |
154 | 155 | ||
155 | struct piix_map_db { | 156 | struct piix_map_db { |
@@ -304,7 +305,7 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
304 | /* SATA Controller IDE (Lynx Point) */ | 305 | /* SATA Controller IDE (Lynx Point) */ |
305 | { 0x8086, 0x8c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | 306 | { 0x8086, 0x8c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
306 | /* SATA Controller IDE (Lynx Point) */ | 307 | /* SATA Controller IDE (Lynx Point) */ |
307 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 308 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, |
308 | /* SATA Controller IDE (Lynx Point) */ | 309 | /* SATA Controller IDE (Lynx Point) */ |
309 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 310 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
310 | /* SATA Controller IDE (Lynx Point-LP) */ | 311 | /* SATA Controller IDE (Lynx Point-LP) */ |
@@ -439,6 +440,7 @@ static const struct piix_map_db *piix_map_db_table[] = { | |||
439 | [ich8m_apple_sata] = &ich8m_apple_map_db, | 440 | [ich8m_apple_sata] = &ich8m_apple_map_db, |
440 | [tolapai_sata] = &tolapai_map_db, | 441 | [tolapai_sata] = &tolapai_map_db, |
441 | [ich8_sata_snb] = &ich8_map_db, | 442 | [ich8_sata_snb] = &ich8_map_db, |
443 | [ich8_2port_sata_snb] = &ich8_2port_map_db, | ||
442 | }; | 444 | }; |
443 | 445 | ||
444 | static struct pci_bits piix_enable_bits[] = { | 446 | static struct pci_bits piix_enable_bits[] = { |
@@ -1242,6 +1244,16 @@ static struct ata_port_info piix_port_info[] = { | |||
1242 | .udma_mask = ATA_UDMA6, | 1244 | .udma_mask = ATA_UDMA6, |
1243 | .port_ops = &piix_sata_ops, | 1245 | .port_ops = &piix_sata_ops, |
1244 | }, | 1246 | }, |
1247 | |||
1248 | [ich8_2port_sata_snb] = | ||
1249 | { | ||
1250 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR | ||
1251 | | PIIX_FLAG_PIO16, | ||
1252 | .pio_mask = ATA_PIO4, | ||
1253 | .mwdma_mask = ATA_MWDMA2, | ||
1254 | .udma_mask = ATA_UDMA6, | ||
1255 | .port_ops = &piix_sata_ops, | ||
1256 | }, | ||
1245 | }; | 1257 | }; |
1246 | 1258 | ||
1247 | #define AHCI_PCI_BAR 5 | 1259 | #define AHCI_PCI_BAR 5 |
@@ -1547,6 +1559,10 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev) | |||
1547 | 1559 | ||
1548 | static int prefer_ms_hyperv = 1; | 1560 | static int prefer_ms_hyperv = 1; |
1549 | module_param(prefer_ms_hyperv, int, 0); | 1561 | module_param(prefer_ms_hyperv, int, 0); |
1562 | MODULE_PARM_DESC(prefer_ms_hyperv, | ||
1563 | "Prefer Hyper-V paravirtualization drivers instead of ATA, " | ||
1564 | "0 - Use ATA drivers, " | ||
1565 | "1 (Default) - Use the paravirtualization drivers."); | ||
1550 | 1566 | ||
1551 | static void piix_ignore_devices_quirk(struct ata_host *host) | 1567 | static void piix_ignore_devices_quirk(struct ata_host *host) |
1552 | { | 1568 | { |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index beea3115577e..8a52dab412e2 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -1027,7 +1027,7 @@ static void ata_acpi_register_power_resource(struct ata_device *dev) | |||
1027 | 1027 | ||
1028 | handle = ata_dev_acpi_handle(dev); | 1028 | handle = ata_dev_acpi_handle(dev); |
1029 | if (handle) | 1029 | if (handle) |
1030 | acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev); | 1030 | acpi_dev_pm_add_dependent(handle, &sdev->sdev_gendev); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) | 1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 497adea1f0d6..63c743baf920 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2329,7 +2329,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2329 | * from SATA Settings page of Identify Device Data Log. | 2329 | * from SATA Settings page of Identify Device Data Log. |
2330 | */ | 2330 | */ |
2331 | if (ata_id_has_devslp(dev->id)) { | 2331 | if (ata_id_has_devslp(dev->id)) { |
2332 | u8 sata_setting[ATA_SECT_SIZE]; | 2332 | u8 *sata_setting = ap->sector_buf; |
2333 | int i, j; | 2333 | int i, j; |
2334 | 2334 | ||
2335 | dev->flags |= ATA_DFLAG_DEVSLP; | 2335 | dev->flags |= ATA_DFLAG_DEVSLP; |
@@ -2439,6 +2439,9 @@ int ata_dev_configure(struct ata_device *dev) | |||
2439 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2439 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
2440 | dev->max_sectors); | 2440 | dev->max_sectors); |
2441 | 2441 | ||
2442 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) | ||
2443 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; | ||
2444 | |||
2442 | if (ap->ops->dev_config) | 2445 | if (ap->ops->dev_config) |
2443 | ap->ops->dev_config(dev); | 2446 | ap->ops->dev_config(dev); |
2444 | 2447 | ||
@@ -4100,6 +4103,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4100 | /* Weird ATAPI devices */ | 4103 | /* Weird ATAPI devices */ |
4101 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | 4104 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
4102 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, | 4105 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, |
4106 | { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | ||
4103 | 4107 | ||
4104 | /* Devices we expect to fail diagnostics */ | 4108 | /* Devices we expect to fail diagnostics */ |
4105 | 4109 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 318b41358187..ff44787e5a45 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -532,8 +532,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) | |||
532 | struct scsi_sense_hdr sshdr; | 532 | struct scsi_sense_hdr sshdr; |
533 | scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, | 533 | scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, |
534 | &sshdr); | 534 | &sshdr); |
535 | if (sshdr.sense_key == 0 && | 535 | if (sshdr.sense_key == RECOVERED_ERROR && |
536 | sshdr.asc == 0 && sshdr.ascq == 0) | 536 | sshdr.asc == 0 && sshdr.ascq == 0x1d) |
537 | cmd_result &= ~SAM_STAT_CHECK_CONDITION; | 537 | cmd_result &= ~SAM_STAT_CHECK_CONDITION; |
538 | } | 538 | } |
539 | 539 | ||
@@ -618,8 +618,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) | |||
618 | struct scsi_sense_hdr sshdr; | 618 | struct scsi_sense_hdr sshdr; |
619 | scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, | 619 | scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, |
620 | &sshdr); | 620 | &sshdr); |
621 | if (sshdr.sense_key == 0 && | 621 | if (sshdr.sense_key == RECOVERED_ERROR && |
622 | sshdr.asc == 0 && sshdr.ascq == 0) | 622 | sshdr.asc == 0 && sshdr.ascq == 0x1d) |
623 | cmd_result &= ~SAM_STAT_CHECK_CONDITION; | 623 | cmd_result &= ~SAM_STAT_CHECK_CONDITION; |
624 | } | 624 | } |
625 | 625 | ||
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 70b0e01372b3..6ef27e98c508 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -661,18 +661,7 @@ static struct platform_driver pata_s3c_driver = { | |||
661 | }, | 661 | }, |
662 | }; | 662 | }; |
663 | 663 | ||
664 | static int __init pata_s3c_init(void) | 664 | module_platform_driver_probe(pata_s3c_driver, pata_s3c_probe); |
665 | { | ||
666 | return platform_driver_probe(&pata_s3c_driver, pata_s3c_probe); | ||
667 | } | ||
668 | |||
669 | static void __exit pata_s3c_exit(void) | ||
670 | { | ||
671 | platform_driver_unregister(&pata_s3c_driver); | ||
672 | } | ||
673 | |||
674 | module_init(pata_s3c_init); | ||
675 | module_exit(pata_s3c_exit); | ||
676 | 665 | ||
677 | MODULE_AUTHOR("Abhilash Kesavan, <a.kesavan@samsung.com>"); | 666 | MODULE_AUTHOR("Abhilash Kesavan, <a.kesavan@samsung.com>"); |
678 | MODULE_DESCRIPTION("low-level driver for Samsung PATA controller"); | 667 | MODULE_DESCRIPTION("low-level driver for Samsung PATA controller"); |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 124b2c1d9c0b..608f82fed632 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -1511,8 +1511,7 @@ error_exit_with_cleanup: | |||
1511 | 1511 | ||
1512 | if (hcr_base) | 1512 | if (hcr_base) |
1513 | iounmap(hcr_base); | 1513 | iounmap(hcr_base); |
1514 | if (host_priv) | 1514 | kfree(host_priv); |
1515 | kfree(host_priv); | ||
1516 | 1515 | ||
1517 | return retval; | 1516 | return retval; |
1518 | } | 1517 | } |
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 5f74587ef258..71671c42ef45 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "power.h" | 46 | #include "power.h" |
47 | 47 | ||
48 | static DEFINE_MUTEX(dev_pm_qos_mtx); | 48 | static DEFINE_MUTEX(dev_pm_qos_mtx); |
49 | static DEFINE_MUTEX(dev_pm_qos_sysfs_mtx); | ||
49 | 50 | ||
50 | static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); | 51 | static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); |
51 | 52 | ||
@@ -216,12 +217,17 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
216 | struct pm_qos_constraints *c; | 217 | struct pm_qos_constraints *c; |
217 | struct pm_qos_flags *f; | 218 | struct pm_qos_flags *f; |
218 | 219 | ||
219 | mutex_lock(&dev_pm_qos_mtx); | 220 | mutex_lock(&dev_pm_qos_sysfs_mtx); |
220 | 221 | ||
221 | /* | 222 | /* |
222 | * If the device's PM QoS resume latency limit or PM QoS flags have been | 223 | * If the device's PM QoS resume latency limit or PM QoS flags have been |
223 | * exposed to user space, they have to be hidden at this point. | 224 | * exposed to user space, they have to be hidden at this point. |
224 | */ | 225 | */ |
226 | pm_qos_sysfs_remove_latency(dev); | ||
227 | pm_qos_sysfs_remove_flags(dev); | ||
228 | |||
229 | mutex_lock(&dev_pm_qos_mtx); | ||
230 | |||
225 | __dev_pm_qos_hide_latency_limit(dev); | 231 | __dev_pm_qos_hide_latency_limit(dev); |
226 | __dev_pm_qos_hide_flags(dev); | 232 | __dev_pm_qos_hide_flags(dev); |
227 | 233 | ||
@@ -254,6 +260,8 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
254 | 260 | ||
255 | out: | 261 | out: |
256 | mutex_unlock(&dev_pm_qos_mtx); | 262 | mutex_unlock(&dev_pm_qos_mtx); |
263 | |||
264 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | ||
257 | } | 265 | } |
258 | 266 | ||
259 | /** | 267 | /** |
@@ -558,6 +566,14 @@ static void __dev_pm_qos_drop_user_request(struct device *dev, | |||
558 | kfree(req); | 566 | kfree(req); |
559 | } | 567 | } |
560 | 568 | ||
569 | static void dev_pm_qos_drop_user_request(struct device *dev, | ||
570 | enum dev_pm_qos_req_type type) | ||
571 | { | ||
572 | mutex_lock(&dev_pm_qos_mtx); | ||
573 | __dev_pm_qos_drop_user_request(dev, type); | ||
574 | mutex_unlock(&dev_pm_qos_mtx); | ||
575 | } | ||
576 | |||
561 | /** | 577 | /** |
562 | * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. | 578 | * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. |
563 | * @dev: Device whose PM QoS latency limit is to be exposed to user space. | 579 | * @dev: Device whose PM QoS latency limit is to be exposed to user space. |
@@ -581,6 +597,8 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
581 | return ret; | 597 | return ret; |
582 | } | 598 | } |
583 | 599 | ||
600 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
601 | |||
584 | mutex_lock(&dev_pm_qos_mtx); | 602 | mutex_lock(&dev_pm_qos_mtx); |
585 | 603 | ||
586 | if (IS_ERR_OR_NULL(dev->power.qos)) | 604 | if (IS_ERR_OR_NULL(dev->power.qos)) |
@@ -591,26 +609,27 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
591 | if (ret < 0) { | 609 | if (ret < 0) { |
592 | __dev_pm_qos_remove_request(req); | 610 | __dev_pm_qos_remove_request(req); |
593 | kfree(req); | 611 | kfree(req); |
612 | mutex_unlock(&dev_pm_qos_mtx); | ||
594 | goto out; | 613 | goto out; |
595 | } | 614 | } |
596 | |||
597 | dev->power.qos->latency_req = req; | 615 | dev->power.qos->latency_req = req; |
616 | |||
617 | mutex_unlock(&dev_pm_qos_mtx); | ||
618 | |||
598 | ret = pm_qos_sysfs_add_latency(dev); | 619 | ret = pm_qos_sysfs_add_latency(dev); |
599 | if (ret) | 620 | if (ret) |
600 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); | 621 | dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); |
601 | 622 | ||
602 | out: | 623 | out: |
603 | mutex_unlock(&dev_pm_qos_mtx); | 624 | mutex_unlock(&dev_pm_qos_sysfs_mtx); |
604 | return ret; | 625 | return ret; |
605 | } | 626 | } |
606 | EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); | 627 | EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); |
607 | 628 | ||
608 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) | 629 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) |
609 | { | 630 | { |
610 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) { | 631 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) |
611 | pm_qos_sysfs_remove_latency(dev); | ||
612 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); | 632 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); |
613 | } | ||
614 | } | 633 | } |
615 | 634 | ||
616 | /** | 635 | /** |
@@ -619,9 +638,15 @@ static void __dev_pm_qos_hide_latency_limit(struct device *dev) | |||
619 | */ | 638 | */ |
620 | void dev_pm_qos_hide_latency_limit(struct device *dev) | 639 | void dev_pm_qos_hide_latency_limit(struct device *dev) |
621 | { | 640 | { |
641 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
642 | |||
643 | pm_qos_sysfs_remove_latency(dev); | ||
644 | |||
622 | mutex_lock(&dev_pm_qos_mtx); | 645 | mutex_lock(&dev_pm_qos_mtx); |
623 | __dev_pm_qos_hide_latency_limit(dev); | 646 | __dev_pm_qos_hide_latency_limit(dev); |
624 | mutex_unlock(&dev_pm_qos_mtx); | 647 | mutex_unlock(&dev_pm_qos_mtx); |
648 | |||
649 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | ||
625 | } | 650 | } |
626 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); | 651 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); |
627 | 652 | ||
@@ -649,6 +674,8 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val) | |||
649 | } | 674 | } |
650 | 675 | ||
651 | pm_runtime_get_sync(dev); | 676 | pm_runtime_get_sync(dev); |
677 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
678 | |||
652 | mutex_lock(&dev_pm_qos_mtx); | 679 | mutex_lock(&dev_pm_qos_mtx); |
653 | 680 | ||
654 | if (IS_ERR_OR_NULL(dev->power.qos)) | 681 | if (IS_ERR_OR_NULL(dev->power.qos)) |
@@ -659,16 +686,19 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val) | |||
659 | if (ret < 0) { | 686 | if (ret < 0) { |
660 | __dev_pm_qos_remove_request(req); | 687 | __dev_pm_qos_remove_request(req); |
661 | kfree(req); | 688 | kfree(req); |
689 | mutex_unlock(&dev_pm_qos_mtx); | ||
662 | goto out; | 690 | goto out; |
663 | } | 691 | } |
664 | |||
665 | dev->power.qos->flags_req = req; | 692 | dev->power.qos->flags_req = req; |
693 | |||
694 | mutex_unlock(&dev_pm_qos_mtx); | ||
695 | |||
666 | ret = pm_qos_sysfs_add_flags(dev); | 696 | ret = pm_qos_sysfs_add_flags(dev); |
667 | if (ret) | 697 | if (ret) |
668 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); | 698 | dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); |
669 | 699 | ||
670 | out: | 700 | out: |
671 | mutex_unlock(&dev_pm_qos_mtx); | 701 | mutex_unlock(&dev_pm_qos_sysfs_mtx); |
672 | pm_runtime_put(dev); | 702 | pm_runtime_put(dev); |
673 | return ret; | 703 | return ret; |
674 | } | 704 | } |
@@ -676,10 +706,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags); | |||
676 | 706 | ||
677 | static void __dev_pm_qos_hide_flags(struct device *dev) | 707 | static void __dev_pm_qos_hide_flags(struct device *dev) |
678 | { | 708 | { |
679 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) { | 709 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) |
680 | pm_qos_sysfs_remove_flags(dev); | ||
681 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); | 710 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); |
682 | } | ||
683 | } | 711 | } |
684 | 712 | ||
685 | /** | 713 | /** |
@@ -689,9 +717,15 @@ static void __dev_pm_qos_hide_flags(struct device *dev) | |||
689 | void dev_pm_qos_hide_flags(struct device *dev) | 717 | void dev_pm_qos_hide_flags(struct device *dev) |
690 | { | 718 | { |
691 | pm_runtime_get_sync(dev); | 719 | pm_runtime_get_sync(dev); |
720 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
721 | |||
722 | pm_qos_sysfs_remove_flags(dev); | ||
723 | |||
692 | mutex_lock(&dev_pm_qos_mtx); | 724 | mutex_lock(&dev_pm_qos_mtx); |
693 | __dev_pm_qos_hide_flags(dev); | 725 | __dev_pm_qos_hide_flags(dev); |
694 | mutex_unlock(&dev_pm_qos_mtx); | 726 | mutex_unlock(&dev_pm_qos_mtx); |
727 | |||
728 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | ||
695 | pm_runtime_put(dev); | 729 | pm_runtime_put(dev); |
696 | } | 730 | } |
697 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); | 731 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index e6732cf7c06e..79f4fca9877a 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
398 | base = 0; | 398 | base = 0; |
399 | 399 | ||
400 | if (max < rbnode->base_reg + rbnode->blklen) | 400 | if (max < rbnode->base_reg + rbnode->blklen) |
401 | end = rbnode->base_reg + rbnode->blklen - max; | 401 | end = max - rbnode->base_reg + 1; |
402 | else | 402 | else |
403 | end = rbnode->blklen; | 403 | end = rbnode->blklen; |
404 | 404 | ||
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 3d2367501fd0..58cfb3232428 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -710,12 +710,12 @@ skip_format_initialization: | |||
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | regmap_debugfs_init(map, config->name); | ||
714 | |||
713 | ret = regcache_init(map, config); | 715 | ret = regcache_init(map, config); |
714 | if (ret != 0) | 716 | if (ret != 0) |
715 | goto err_range; | 717 | goto err_range; |
716 | 718 | ||
717 | regmap_debugfs_init(map, config->name); | ||
718 | |||
719 | /* Add a devres resource for dev_get_regmap() */ | 719 | /* Add a devres resource for dev_get_regmap() */ |
720 | m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); | 720 | m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); |
721 | if (!m) { | 721 | if (!m) { |
@@ -1036,6 +1036,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
1036 | kfree(async->work_buf); | 1036 | kfree(async->work_buf); |
1037 | kfree(async); | 1037 | kfree(async); |
1038 | } | 1038 | } |
1039 | |||
1040 | return ret; | ||
1039 | } | 1041 | } |
1040 | 1042 | ||
1041 | trace_regmap_hw_write_start(map->dev, reg, | 1043 | trace_regmap_hw_write_start(map->dev, reg, |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 5dc0daed8fac..b81ddfea1da0 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -532,11 +532,11 @@ config BLK_DEV_RBD | |||
532 | If unsure, say N. | 532 | If unsure, say N. |
533 | 533 | ||
534 | config BLK_DEV_RSXX | 534 | config BLK_DEV_RSXX |
535 | tristate "RamSam PCIe Flash SSD Device Driver" | 535 | tristate "IBM FlashSystem 70/80 PCIe SSD Device Driver" |
536 | depends on PCI | 536 | depends on PCI |
537 | help | 537 | help |
538 | Device driver for IBM's high speed PCIe SSD | 538 | Device driver for IBM's high speed PCIe SSD |
539 | storage devices: RamSan-70 and RamSan-80. | 539 | storage devices: FlashSystem-70 and FlashSystem-80. |
540 | 540 | ||
541 | To compile this driver as a module, choose M here: the | 541 | To compile this driver as a module, choose M here: the |
542 | module will be called rsxx. | 542 | module will be called rsxx. |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 25ef5c014fca..92b6d7c51e39 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -51,8 +51,9 @@ new_skb(ulong len) | |||
51 | { | 51 | { |
52 | struct sk_buff *skb; | 52 | struct sk_buff *skb; |
53 | 53 | ||
54 | skb = alloc_skb(len, GFP_ATOMIC); | 54 | skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC); |
55 | if (skb) { | 55 | if (skb) { |
56 | skb_reserve(skb, MAX_HEADER); | ||
56 | skb_reset_mac_header(skb); | 57 | skb_reset_mac_header(skb); |
57 | skb_reset_network_header(skb); | 58 | skb_reset_network_header(skb); |
58 | skb->protocol = __constant_htons(ETH_P_AOE); | 59 | skb->protocol = __constant_htons(ETH_P_AOE); |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index ade58bc8f3c4..1c1b8e544aa2 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -4206,7 +4206,7 @@ static int cciss_find_cfgtables(ctlr_info_t *h) | |||
4206 | if (rc) | 4206 | if (rc) |
4207 | return rc; | 4207 | return rc; |
4208 | h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev, | 4208 | h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev, |
4209 | cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable)); | 4209 | cfg_base_addr_index) + cfg_offset, sizeof(*h->cfgtable)); |
4210 | if (!h->cfgtable) | 4210 | if (!h->cfgtable) |
4211 | return -ENOMEM; | 4211 | return -ENOMEM; |
4212 | rc = write_driver_ver_to_cfgtable(h->cfgtable); | 4212 | rc = write_driver_ver_to_cfgtable(h->cfgtable); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 747bb2af69dc..dfe758382eaf 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -922,6 +922,11 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, | |||
922 | lo->lo_flags |= LO_FLAGS_PARTSCAN; | 922 | lo->lo_flags |= LO_FLAGS_PARTSCAN; |
923 | if (lo->lo_flags & LO_FLAGS_PARTSCAN) | 923 | if (lo->lo_flags & LO_FLAGS_PARTSCAN) |
924 | ioctl_by_bdev(bdev, BLKRRPART, 0); | 924 | ioctl_by_bdev(bdev, BLKRRPART, 0); |
925 | |||
926 | /* Grab the block_device to prevent its destruction after we | ||
927 | * put /dev/loopXX inode. Later in loop_clr_fd() we bdput(bdev). | ||
928 | */ | ||
929 | bdgrab(bdev); | ||
925 | return 0; | 930 | return 0; |
926 | 931 | ||
927 | out_clr: | 932 | out_clr: |
@@ -1031,8 +1036,10 @@ static int loop_clr_fd(struct loop_device *lo) | |||
1031 | memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); | 1036 | memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); |
1032 | memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); | 1037 | memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); |
1033 | memset(lo->lo_file_name, 0, LO_NAME_SIZE); | 1038 | memset(lo->lo_file_name, 0, LO_NAME_SIZE); |
1034 | if (bdev) | 1039 | if (bdev) { |
1040 | bdput(bdev); | ||
1035 | invalidate_bdev(bdev); | 1041 | invalidate_bdev(bdev); |
1042 | } | ||
1036 | set_capacity(lo->lo_disk, 0); | 1043 | set_capacity(lo->lo_disk, 0); |
1037 | loop_sysfs_exit(lo); | 1044 | loop_sysfs_exit(lo); |
1038 | if (bdev) { | 1045 | if (bdev) { |
@@ -1623,6 +1630,7 @@ static int loop_add(struct loop_device **l, int i) | |||
1623 | goto out_free_dev; | 1630 | goto out_free_dev; |
1624 | i = err; | 1631 | i = err; |
1625 | 1632 | ||
1633 | err = -ENOMEM; | ||
1626 | lo->lo_queue = blk_alloc_queue(GFP_KERNEL); | 1634 | lo->lo_queue = blk_alloc_queue(GFP_KERNEL); |
1627 | if (!lo->lo_queue) | 1635 | if (!lo->lo_queue) |
1628 | goto out_free_dev; | 1636 | goto out_free_dev; |
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 1788f491e0fb..076ae7f1b781 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -890,8 +890,10 @@ static int mg_probe(struct platform_device *plat_dev) | |||
890 | gpio_direction_output(host->rst, 1); | 890 | gpio_direction_output(host->rst, 1); |
891 | 891 | ||
892 | /* reset out pin */ | 892 | /* reset out pin */ |
893 | if (!(prv_data->dev_attr & MG_DEV_MASK)) | 893 | if (!(prv_data->dev_attr & MG_DEV_MASK)) { |
894 | err = -EINVAL; | ||
894 | goto probe_err_3a; | 895 | goto probe_err_3a; |
896 | } | ||
895 | 897 | ||
896 | if (prv_data->dev_attr != MG_BOOT_DEV) { | 898 | if (prv_data->dev_attr != MG_BOOT_DEV) { |
897 | rsc = platform_get_resource_byname(plat_dev, IORESOURCE_IO, | 899 | rsc = platform_get_resource_byname(plat_dev, IORESOURCE_IO, |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 11cc9522cdd4..32c678028e53 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -81,12 +81,17 @@ | |||
81 | /* Device instance number, incremented each time a device is probed. */ | 81 | /* Device instance number, incremented each time a device is probed. */ |
82 | static int instance; | 82 | static int instance; |
83 | 83 | ||
84 | struct list_head online_list; | ||
85 | struct list_head removing_list; | ||
86 | spinlock_t dev_lock; | ||
87 | |||
84 | /* | 88 | /* |
85 | * Global variable used to hold the major block device number | 89 | * Global variable used to hold the major block device number |
86 | * allocated in mtip_init(). | 90 | * allocated in mtip_init(). |
87 | */ | 91 | */ |
88 | static int mtip_major; | 92 | static int mtip_major; |
89 | static struct dentry *dfs_parent; | 93 | static struct dentry *dfs_parent; |
94 | static struct dentry *dfs_device_status; | ||
90 | 95 | ||
91 | static u32 cpu_use[NR_CPUS]; | 96 | static u32 cpu_use[NR_CPUS]; |
92 | 97 | ||
@@ -243,40 +248,31 @@ static inline void release_slot(struct mtip_port *port, int tag) | |||
243 | /* | 248 | /* |
244 | * Reset the HBA (without sleeping) | 249 | * Reset the HBA (without sleeping) |
245 | * | 250 | * |
246 | * Just like hba_reset, except does not call sleep, so can be | ||
247 | * run from interrupt/tasklet context. | ||
248 | * | ||
249 | * @dd Pointer to the driver data structure. | 251 | * @dd Pointer to the driver data structure. |
250 | * | 252 | * |
251 | * return value | 253 | * return value |
252 | * 0 The reset was successful. | 254 | * 0 The reset was successful. |
253 | * -1 The HBA Reset bit did not clear. | 255 | * -1 The HBA Reset bit did not clear. |
254 | */ | 256 | */ |
255 | static int hba_reset_nosleep(struct driver_data *dd) | 257 | static int mtip_hba_reset(struct driver_data *dd) |
256 | { | 258 | { |
257 | unsigned long timeout; | 259 | unsigned long timeout; |
258 | 260 | ||
259 | /* Chip quirk: quiesce any chip function */ | ||
260 | mdelay(10); | ||
261 | |||
262 | /* Set the reset bit */ | 261 | /* Set the reset bit */ |
263 | writel(HOST_RESET, dd->mmio + HOST_CTL); | 262 | writel(HOST_RESET, dd->mmio + HOST_CTL); |
264 | 263 | ||
265 | /* Flush */ | 264 | /* Flush */ |
266 | readl(dd->mmio + HOST_CTL); | 265 | readl(dd->mmio + HOST_CTL); |
267 | 266 | ||
268 | /* | 267 | /* Spin for up to 2 seconds, waiting for reset acknowledgement */ |
269 | * Wait 10ms then spin for up to 1 second | 268 | timeout = jiffies + msecs_to_jiffies(2000); |
270 | * waiting for reset acknowledgement | 269 | do { |
271 | */ | 270 | mdelay(10); |
272 | timeout = jiffies + msecs_to_jiffies(1000); | 271 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) |
273 | mdelay(10); | 272 | return -1; |
274 | while ((readl(dd->mmio + HOST_CTL) & HOST_RESET) | ||
275 | && time_before(jiffies, timeout)) | ||
276 | mdelay(1); | ||
277 | 273 | ||
278 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) | 274 | } while ((readl(dd->mmio + HOST_CTL) & HOST_RESET) |
279 | return -1; | 275 | && time_before(jiffies, timeout)); |
280 | 276 | ||
281 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) | 277 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) |
282 | return -1; | 278 | return -1; |
@@ -481,7 +477,7 @@ static void mtip_restart_port(struct mtip_port *port) | |||
481 | dev_warn(&port->dd->pdev->dev, | 477 | dev_warn(&port->dd->pdev->dev, |
482 | "PxCMD.CR not clear, escalating reset\n"); | 478 | "PxCMD.CR not clear, escalating reset\n"); |
483 | 479 | ||
484 | if (hba_reset_nosleep(port->dd)) | 480 | if (mtip_hba_reset(port->dd)) |
485 | dev_err(&port->dd->pdev->dev, | 481 | dev_err(&port->dd->pdev->dev, |
486 | "HBA reset escalation failed.\n"); | 482 | "HBA reset escalation failed.\n"); |
487 | 483 | ||
@@ -527,6 +523,26 @@ static void mtip_restart_port(struct mtip_port *port) | |||
527 | 523 | ||
528 | } | 524 | } |
529 | 525 | ||
526 | static int mtip_device_reset(struct driver_data *dd) | ||
527 | { | ||
528 | int rv = 0; | ||
529 | |||
530 | if (mtip_check_surprise_removal(dd->pdev)) | ||
531 | return 0; | ||
532 | |||
533 | if (mtip_hba_reset(dd) < 0) | ||
534 | rv = -EFAULT; | ||
535 | |||
536 | mdelay(1); | ||
537 | mtip_init_port(dd->port); | ||
538 | mtip_start_port(dd->port); | ||
539 | |||
540 | /* Enable interrupts on the HBA. */ | ||
541 | writel(readl(dd->mmio + HOST_CTL) | HOST_IRQ_EN, | ||
542 | dd->mmio + HOST_CTL); | ||
543 | return rv; | ||
544 | } | ||
545 | |||
530 | /* | 546 | /* |
531 | * Helper function for tag logging | 547 | * Helper function for tag logging |
532 | */ | 548 | */ |
@@ -632,7 +648,7 @@ static void mtip_timeout_function(unsigned long int data) | |||
632 | if (cmdto_cnt) { | 648 | if (cmdto_cnt) { |
633 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); | 649 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); |
634 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { | 650 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { |
635 | mtip_restart_port(port); | 651 | mtip_device_reset(port->dd); |
636 | wake_up_interruptible(&port->svc_wait); | 652 | wake_up_interruptible(&port->svc_wait); |
637 | } | 653 | } |
638 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); | 654 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
@@ -1283,11 +1299,11 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1283 | int rv = 0, ready2go = 1; | 1299 | int rv = 0, ready2go = 1; |
1284 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; | 1300 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; |
1285 | unsigned long to; | 1301 | unsigned long to; |
1302 | struct driver_data *dd = port->dd; | ||
1286 | 1303 | ||
1287 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ | 1304 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ |
1288 | if (buffer & 0x00000007) { | 1305 | if (buffer & 0x00000007) { |
1289 | dev_err(&port->dd->pdev->dev, | 1306 | dev_err(&dd->pdev->dev, "SG buffer is not 8 byte aligned\n"); |
1290 | "SG buffer is not 8 byte aligned\n"); | ||
1291 | return -EFAULT; | 1307 | return -EFAULT; |
1292 | } | 1308 | } |
1293 | 1309 | ||
@@ -1300,23 +1316,21 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1300 | mdelay(100); | 1316 | mdelay(100); |
1301 | } while (time_before(jiffies, to)); | 1317 | } while (time_before(jiffies, to)); |
1302 | if (!ready2go) { | 1318 | if (!ready2go) { |
1303 | dev_warn(&port->dd->pdev->dev, | 1319 | dev_warn(&dd->pdev->dev, |
1304 | "Internal cmd active. new cmd [%02X]\n", fis->command); | 1320 | "Internal cmd active. new cmd [%02X]\n", fis->command); |
1305 | return -EBUSY; | 1321 | return -EBUSY; |
1306 | } | 1322 | } |
1307 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | 1323 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
1308 | port->ic_pause_timer = 0; | 1324 | port->ic_pause_timer = 0; |
1309 | 1325 | ||
1310 | if (fis->command == ATA_CMD_SEC_ERASE_UNIT) | 1326 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); |
1311 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | 1327 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); |
1312 | else if (fis->command == ATA_CMD_DOWNLOAD_MICRO) | ||
1313 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
1314 | 1328 | ||
1315 | if (atomic == GFP_KERNEL) { | 1329 | if (atomic == GFP_KERNEL) { |
1316 | if (fis->command != ATA_CMD_STANDBYNOW1) { | 1330 | if (fis->command != ATA_CMD_STANDBYNOW1) { |
1317 | /* wait for io to complete if non atomic */ | 1331 | /* wait for io to complete if non atomic */ |
1318 | if (mtip_quiesce_io(port, 5000) < 0) { | 1332 | if (mtip_quiesce_io(port, 5000) < 0) { |
1319 | dev_warn(&port->dd->pdev->dev, | 1333 | dev_warn(&dd->pdev->dev, |
1320 | "Failed to quiesce IO\n"); | 1334 | "Failed to quiesce IO\n"); |
1321 | release_slot(port, MTIP_TAG_INTERNAL); | 1335 | release_slot(port, MTIP_TAG_INTERNAL); |
1322 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | 1336 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
@@ -1361,58 +1375,84 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1361 | /* Issue the command to the hardware */ | 1375 | /* Issue the command to the hardware */ |
1362 | mtip_issue_non_ncq_command(port, MTIP_TAG_INTERNAL); | 1376 | mtip_issue_non_ncq_command(port, MTIP_TAG_INTERNAL); |
1363 | 1377 | ||
1364 | /* Poll if atomic, wait_for_completion otherwise */ | ||
1365 | if (atomic == GFP_KERNEL) { | 1378 | if (atomic == GFP_KERNEL) { |
1366 | /* Wait for the command to complete or timeout. */ | 1379 | /* Wait for the command to complete or timeout. */ |
1367 | if (wait_for_completion_timeout( | 1380 | if (wait_for_completion_interruptible_timeout( |
1368 | &wait, | 1381 | &wait, |
1369 | msecs_to_jiffies(timeout)) == 0) { | 1382 | msecs_to_jiffies(timeout)) <= 0) { |
1370 | dev_err(&port->dd->pdev->dev, | 1383 | if (rv == -ERESTARTSYS) { /* interrupted */ |
1371 | "Internal command did not complete [%d] " | 1384 | dev_err(&dd->pdev->dev, |
1372 | "within timeout of %lu ms\n", | 1385 | "Internal command [%02X] was interrupted after %lu ms\n", |
1373 | atomic, timeout); | 1386 | fis->command, timeout); |
1374 | if (mtip_check_surprise_removal(port->dd->pdev) || | 1387 | rv = -EINTR; |
1388 | goto exec_ic_exit; | ||
1389 | } else if (rv == 0) /* timeout */ | ||
1390 | dev_err(&dd->pdev->dev, | ||
1391 | "Internal command did not complete [%02X] within timeout of %lu ms\n", | ||
1392 | fis->command, timeout); | ||
1393 | else | ||
1394 | dev_err(&dd->pdev->dev, | ||
1395 | "Internal command [%02X] wait returned code [%d] after %lu ms - unhandled\n", | ||
1396 | fis->command, rv, timeout); | ||
1397 | |||
1398 | if (mtip_check_surprise_removal(dd->pdev) || | ||
1375 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | 1399 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
1376 | &port->dd->dd_flag)) { | 1400 | &dd->dd_flag)) { |
1401 | dev_err(&dd->pdev->dev, | ||
1402 | "Internal command [%02X] wait returned due to SR\n", | ||
1403 | fis->command); | ||
1377 | rv = -ENXIO; | 1404 | rv = -ENXIO; |
1378 | goto exec_ic_exit; | 1405 | goto exec_ic_exit; |
1379 | } | 1406 | } |
1407 | mtip_device_reset(dd); /* recover from timeout issue */ | ||
1380 | rv = -EAGAIN; | 1408 | rv = -EAGAIN; |
1409 | goto exec_ic_exit; | ||
1381 | } | 1410 | } |
1382 | } else { | 1411 | } else { |
1412 | u32 hba_stat, port_stat; | ||
1413 | |||
1383 | /* Spin for <timeout> checking if command still outstanding */ | 1414 | /* Spin for <timeout> checking if command still outstanding */ |
1384 | timeout = jiffies + msecs_to_jiffies(timeout); | 1415 | timeout = jiffies + msecs_to_jiffies(timeout); |
1385 | while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1416 | while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
1386 | & (1 << MTIP_TAG_INTERNAL)) | 1417 | & (1 << MTIP_TAG_INTERNAL)) |
1387 | && time_before(jiffies, timeout)) { | 1418 | && time_before(jiffies, timeout)) { |
1388 | if (mtip_check_surprise_removal(port->dd->pdev)) { | 1419 | if (mtip_check_surprise_removal(dd->pdev)) { |
1389 | rv = -ENXIO; | 1420 | rv = -ENXIO; |
1390 | goto exec_ic_exit; | 1421 | goto exec_ic_exit; |
1391 | } | 1422 | } |
1392 | if ((fis->command != ATA_CMD_STANDBYNOW1) && | 1423 | if ((fis->command != ATA_CMD_STANDBYNOW1) && |
1393 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | 1424 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
1394 | &port->dd->dd_flag)) { | 1425 | &dd->dd_flag)) { |
1395 | rv = -ENXIO; | 1426 | rv = -ENXIO; |
1396 | goto exec_ic_exit; | 1427 | goto exec_ic_exit; |
1397 | } | 1428 | } |
1398 | if (readl(port->mmio + PORT_IRQ_STAT) & PORT_IRQ_ERR) { | 1429 | port_stat = readl(port->mmio + PORT_IRQ_STAT); |
1399 | atomic_inc(&int_cmd->active); /* error */ | 1430 | if (!port_stat) |
1400 | break; | 1431 | continue; |
1432 | |||
1433 | if (port_stat & PORT_IRQ_ERR) { | ||
1434 | dev_err(&dd->pdev->dev, | ||
1435 | "Internal command [%02X] failed\n", | ||
1436 | fis->command); | ||
1437 | mtip_device_reset(dd); | ||
1438 | rv = -EIO; | ||
1439 | goto exec_ic_exit; | ||
1440 | } else { | ||
1441 | writel(port_stat, port->mmio + PORT_IRQ_STAT); | ||
1442 | hba_stat = readl(dd->mmio + HOST_IRQ_STAT); | ||
1443 | if (hba_stat) | ||
1444 | writel(hba_stat, | ||
1445 | dd->mmio + HOST_IRQ_STAT); | ||
1401 | } | 1446 | } |
1447 | break; | ||
1402 | } | 1448 | } |
1403 | } | 1449 | } |
1404 | 1450 | ||
1405 | if (atomic_read(&int_cmd->active) > 1) { | ||
1406 | dev_err(&port->dd->pdev->dev, | ||
1407 | "Internal command [%02X] failed\n", fis->command); | ||
1408 | rv = -EIO; | ||
1409 | } | ||
1410 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1451 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
1411 | & (1 << MTIP_TAG_INTERNAL)) { | 1452 | & (1 << MTIP_TAG_INTERNAL)) { |
1412 | rv = -ENXIO; | 1453 | rv = -ENXIO; |
1413 | if (!test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | 1454 | if (!test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) { |
1414 | &port->dd->dd_flag)) { | 1455 | mtip_device_reset(dd); |
1415 | mtip_restart_port(port); | ||
1416 | rv = -EAGAIN; | 1456 | rv = -EAGAIN; |
1417 | } | 1457 | } |
1418 | } | 1458 | } |
@@ -1724,7 +1764,8 @@ static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, | |||
1724 | * -EINVAL Invalid parameters passed in, trim not supported | 1764 | * -EINVAL Invalid parameters passed in, trim not supported |
1725 | * -EIO Error submitting trim request to hw | 1765 | * -EIO Error submitting trim request to hw |
1726 | */ | 1766 | */ |
1727 | static int mtip_send_trim(struct driver_data *dd, unsigned int lba, unsigned int len) | 1767 | static int mtip_send_trim(struct driver_data *dd, unsigned int lba, |
1768 | unsigned int len) | ||
1728 | { | 1769 | { |
1729 | int i, rv = 0; | 1770 | int i, rv = 0; |
1730 | u64 tlba, tlen, sect_left; | 1771 | u64 tlba, tlen, sect_left; |
@@ -1811,45 +1852,6 @@ static bool mtip_hw_get_capacity(struct driver_data *dd, sector_t *sectors) | |||
1811 | } | 1852 | } |
1812 | 1853 | ||
1813 | /* | 1854 | /* |
1814 | * Reset the HBA. | ||
1815 | * | ||
1816 | * Resets the HBA by setting the HBA Reset bit in the Global | ||
1817 | * HBA Control register. After setting the HBA Reset bit the | ||
1818 | * function waits for 1 second before reading the HBA Reset | ||
1819 | * bit to make sure it has cleared. If HBA Reset is not clear | ||
1820 | * an error is returned. Cannot be used in non-blockable | ||
1821 | * context. | ||
1822 | * | ||
1823 | * @dd Pointer to the driver data structure. | ||
1824 | * | ||
1825 | * return value | ||
1826 | * 0 The reset was successful. | ||
1827 | * -1 The HBA Reset bit did not clear. | ||
1828 | */ | ||
1829 | static int mtip_hba_reset(struct driver_data *dd) | ||
1830 | { | ||
1831 | mtip_deinit_port(dd->port); | ||
1832 | |||
1833 | /* Set the reset bit */ | ||
1834 | writel(HOST_RESET, dd->mmio + HOST_CTL); | ||
1835 | |||
1836 | /* Flush */ | ||
1837 | readl(dd->mmio + HOST_CTL); | ||
1838 | |||
1839 | /* Wait for reset to clear */ | ||
1840 | ssleep(1); | ||
1841 | |||
1842 | /* Check the bit has cleared */ | ||
1843 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) { | ||
1844 | dev_err(&dd->pdev->dev, | ||
1845 | "Reset bit did not clear.\n"); | ||
1846 | return -1; | ||
1847 | } | ||
1848 | |||
1849 | return 0; | ||
1850 | } | ||
1851 | |||
1852 | /* | ||
1853 | * Display the identify command data. | 1855 | * Display the identify command data. |
1854 | * | 1856 | * |
1855 | * @port Pointer to the port data structure. | 1857 | * @port Pointer to the port data structure. |
@@ -2710,6 +2712,100 @@ static ssize_t mtip_hw_show_status(struct device *dev, | |||
2710 | 2712 | ||
2711 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | 2713 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); |
2712 | 2714 | ||
2715 | /* debugsfs entries */ | ||
2716 | |||
2717 | static ssize_t show_device_status(struct device_driver *drv, char *buf) | ||
2718 | { | ||
2719 | int size = 0; | ||
2720 | struct driver_data *dd, *tmp; | ||
2721 | unsigned long flags; | ||
2722 | char id_buf[42]; | ||
2723 | u16 status = 0; | ||
2724 | |||
2725 | spin_lock_irqsave(&dev_lock, flags); | ||
2726 | size += sprintf(&buf[size], "Devices Present:\n"); | ||
2727 | list_for_each_entry_safe(dd, tmp, &online_list, online_list) { | ||
2728 | if (dd->pdev) { | ||
2729 | if (dd->port && | ||
2730 | dd->port->identify && | ||
2731 | dd->port->identify_valid) { | ||
2732 | strlcpy(id_buf, | ||
2733 | (char *) (dd->port->identify + 10), 21); | ||
2734 | status = *(dd->port->identify + 141); | ||
2735 | } else { | ||
2736 | memset(id_buf, 0, 42); | ||
2737 | status = 0; | ||
2738 | } | ||
2739 | |||
2740 | if (dd->port && | ||
2741 | test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) { | ||
2742 | size += sprintf(&buf[size], | ||
2743 | " device %s %s (ftl rebuild %d %%)\n", | ||
2744 | dev_name(&dd->pdev->dev), | ||
2745 | id_buf, | ||
2746 | status); | ||
2747 | } else { | ||
2748 | size += sprintf(&buf[size], | ||
2749 | " device %s %s\n", | ||
2750 | dev_name(&dd->pdev->dev), | ||
2751 | id_buf); | ||
2752 | } | ||
2753 | } | ||
2754 | } | ||
2755 | |||
2756 | size += sprintf(&buf[size], "Devices Being Removed:\n"); | ||
2757 | list_for_each_entry_safe(dd, tmp, &removing_list, remove_list) { | ||
2758 | if (dd->pdev) { | ||
2759 | if (dd->port && | ||
2760 | dd->port->identify && | ||
2761 | dd->port->identify_valid) { | ||
2762 | strlcpy(id_buf, | ||
2763 | (char *) (dd->port->identify+10), 21); | ||
2764 | status = *(dd->port->identify + 141); | ||
2765 | } else { | ||
2766 | memset(id_buf, 0, 42); | ||
2767 | status = 0; | ||
2768 | } | ||
2769 | |||
2770 | if (dd->port && | ||
2771 | test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) { | ||
2772 | size += sprintf(&buf[size], | ||
2773 | " device %s %s (ftl rebuild %d %%)\n", | ||
2774 | dev_name(&dd->pdev->dev), | ||
2775 | id_buf, | ||
2776 | status); | ||
2777 | } else { | ||
2778 | size += sprintf(&buf[size], | ||
2779 | " device %s %s\n", | ||
2780 | dev_name(&dd->pdev->dev), | ||
2781 | id_buf); | ||
2782 | } | ||
2783 | } | ||
2784 | } | ||
2785 | spin_unlock_irqrestore(&dev_lock, flags); | ||
2786 | |||
2787 | return size; | ||
2788 | } | ||
2789 | |||
2790 | static ssize_t mtip_hw_read_device_status(struct file *f, char __user *ubuf, | ||
2791 | size_t len, loff_t *offset) | ||
2792 | { | ||
2793 | int size = *offset; | ||
2794 | char buf[MTIP_DFS_MAX_BUF_SIZE]; | ||
2795 | |||
2796 | if (!len || *offset) | ||
2797 | return 0; | ||
2798 | |||
2799 | size += show_device_status(NULL, buf); | ||
2800 | |||
2801 | *offset = size <= len ? size : len; | ||
2802 | size = copy_to_user(ubuf, buf, *offset); | ||
2803 | if (size) | ||
2804 | return -EFAULT; | ||
2805 | |||
2806 | return *offset; | ||
2807 | } | ||
2808 | |||
2713 | static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, | 2809 | static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, |
2714 | size_t len, loff_t *offset) | 2810 | size_t len, loff_t *offset) |
2715 | { | 2811 | { |
@@ -2804,6 +2900,13 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf, | |||
2804 | return *offset; | 2900 | return *offset; |
2805 | } | 2901 | } |
2806 | 2902 | ||
2903 | static const struct file_operations mtip_device_status_fops = { | ||
2904 | .owner = THIS_MODULE, | ||
2905 | .open = simple_open, | ||
2906 | .read = mtip_hw_read_device_status, | ||
2907 | .llseek = no_llseek, | ||
2908 | }; | ||
2909 | |||
2807 | static const struct file_operations mtip_regs_fops = { | 2910 | static const struct file_operations mtip_regs_fops = { |
2808 | .owner = THIS_MODULE, | 2911 | .owner = THIS_MODULE, |
2809 | .open = simple_open, | 2912 | .open = simple_open, |
@@ -4161,6 +4264,7 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
4161 | const struct cpumask *node_mask; | 4264 | const struct cpumask *node_mask; |
4162 | int cpu, i = 0, j = 0; | 4265 | int cpu, i = 0, j = 0; |
4163 | int my_node = NUMA_NO_NODE; | 4266 | int my_node = NUMA_NO_NODE; |
4267 | unsigned long flags; | ||
4164 | 4268 | ||
4165 | /* Allocate memory for this devices private data. */ | 4269 | /* Allocate memory for this devices private data. */ |
4166 | my_node = pcibus_to_node(pdev->bus); | 4270 | my_node = pcibus_to_node(pdev->bus); |
@@ -4218,12 +4322,16 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
4218 | dd->pdev = pdev; | 4322 | dd->pdev = pdev; |
4219 | dd->numa_node = my_node; | 4323 | dd->numa_node = my_node; |
4220 | 4324 | ||
4325 | INIT_LIST_HEAD(&dd->online_list); | ||
4326 | INIT_LIST_HEAD(&dd->remove_list); | ||
4327 | |||
4221 | memset(dd->workq_name, 0, 32); | 4328 | memset(dd->workq_name, 0, 32); |
4222 | snprintf(dd->workq_name, 31, "mtipq%d", dd->instance); | 4329 | snprintf(dd->workq_name, 31, "mtipq%d", dd->instance); |
4223 | 4330 | ||
4224 | dd->isr_workq = create_workqueue(dd->workq_name); | 4331 | dd->isr_workq = create_workqueue(dd->workq_name); |
4225 | if (!dd->isr_workq) { | 4332 | if (!dd->isr_workq) { |
4226 | dev_warn(&pdev->dev, "Can't create wq %d\n", dd->instance); | 4333 | dev_warn(&pdev->dev, "Can't create wq %d\n", dd->instance); |
4334 | rv = -ENOMEM; | ||
4227 | goto block_initialize_err; | 4335 | goto block_initialize_err; |
4228 | } | 4336 | } |
4229 | 4337 | ||
@@ -4282,7 +4390,8 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
4282 | INIT_WORK(&dd->work[7].work, mtip_workq_sdbf7); | 4390 | INIT_WORK(&dd->work[7].work, mtip_workq_sdbf7); |
4283 | 4391 | ||
4284 | pci_set_master(pdev); | 4392 | pci_set_master(pdev); |
4285 | if (pci_enable_msi(pdev)) { | 4393 | rv = pci_enable_msi(pdev); |
4394 | if (rv) { | ||
4286 | dev_warn(&pdev->dev, | 4395 | dev_warn(&pdev->dev, |
4287 | "Unable to enable MSI interrupt.\n"); | 4396 | "Unable to enable MSI interrupt.\n"); |
4288 | goto block_initialize_err; | 4397 | goto block_initialize_err; |
@@ -4303,6 +4412,14 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
4303 | instance++; | 4412 | instance++; |
4304 | if (rv != MTIP_FTL_REBUILD_MAGIC) | 4413 | if (rv != MTIP_FTL_REBUILD_MAGIC) |
4305 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | 4414 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); |
4415 | else | ||
4416 | rv = 0; /* device in rebuild state, return 0 from probe */ | ||
4417 | |||
4418 | /* Add to online list even if in ftl rebuild */ | ||
4419 | spin_lock_irqsave(&dev_lock, flags); | ||
4420 | list_add(&dd->online_list, &online_list); | ||
4421 | spin_unlock_irqrestore(&dev_lock, flags); | ||
4422 | |||
4306 | goto done; | 4423 | goto done; |
4307 | 4424 | ||
4308 | block_initialize_err: | 4425 | block_initialize_err: |
@@ -4336,9 +4453,15 @@ static void mtip_pci_remove(struct pci_dev *pdev) | |||
4336 | { | 4453 | { |
4337 | struct driver_data *dd = pci_get_drvdata(pdev); | 4454 | struct driver_data *dd = pci_get_drvdata(pdev); |
4338 | int counter = 0; | 4455 | int counter = 0; |
4456 | unsigned long flags; | ||
4339 | 4457 | ||
4340 | set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag); | 4458 | set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag); |
4341 | 4459 | ||
4460 | spin_lock_irqsave(&dev_lock, flags); | ||
4461 | list_del_init(&dd->online_list); | ||
4462 | list_add(&dd->remove_list, &removing_list); | ||
4463 | spin_unlock_irqrestore(&dev_lock, flags); | ||
4464 | |||
4342 | if (mtip_check_surprise_removal(pdev)) { | 4465 | if (mtip_check_surprise_removal(pdev)) { |
4343 | while (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { | 4466 | while (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { |
4344 | counter++; | 4467 | counter++; |
@@ -4364,6 +4487,10 @@ static void mtip_pci_remove(struct pci_dev *pdev) | |||
4364 | 4487 | ||
4365 | pci_disable_msi(pdev); | 4488 | pci_disable_msi(pdev); |
4366 | 4489 | ||
4490 | spin_lock_irqsave(&dev_lock, flags); | ||
4491 | list_del_init(&dd->remove_list); | ||
4492 | spin_unlock_irqrestore(&dev_lock, flags); | ||
4493 | |||
4367 | kfree(dd); | 4494 | kfree(dd); |
4368 | pcim_iounmap_regions(pdev, 1 << MTIP_ABAR); | 4495 | pcim_iounmap_regions(pdev, 1 << MTIP_ABAR); |
4369 | } | 4496 | } |
@@ -4511,6 +4638,11 @@ static int __init mtip_init(void) | |||
4511 | 4638 | ||
4512 | pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); | 4639 | pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); |
4513 | 4640 | ||
4641 | spin_lock_init(&dev_lock); | ||
4642 | |||
4643 | INIT_LIST_HEAD(&online_list); | ||
4644 | INIT_LIST_HEAD(&removing_list); | ||
4645 | |||
4514 | /* Allocate a major block device number to use with this driver. */ | 4646 | /* Allocate a major block device number to use with this driver. */ |
4515 | error = register_blkdev(0, MTIP_DRV_NAME); | 4647 | error = register_blkdev(0, MTIP_DRV_NAME); |
4516 | if (error <= 0) { | 4648 | if (error <= 0) { |
@@ -4520,11 +4652,18 @@ static int __init mtip_init(void) | |||
4520 | } | 4652 | } |
4521 | mtip_major = error; | 4653 | mtip_major = error; |
4522 | 4654 | ||
4523 | if (!dfs_parent) { | 4655 | dfs_parent = debugfs_create_dir("rssd", NULL); |
4524 | dfs_parent = debugfs_create_dir("rssd", NULL); | 4656 | if (IS_ERR_OR_NULL(dfs_parent)) { |
4525 | if (IS_ERR_OR_NULL(dfs_parent)) { | 4657 | pr_warn("Error creating debugfs parent\n"); |
4526 | pr_warn("Error creating debugfs parent\n"); | 4658 | dfs_parent = NULL; |
4527 | dfs_parent = NULL; | 4659 | } |
4660 | if (dfs_parent) { | ||
4661 | dfs_device_status = debugfs_create_file("device_status", | ||
4662 | S_IRUGO, dfs_parent, NULL, | ||
4663 | &mtip_device_status_fops); | ||
4664 | if (IS_ERR_OR_NULL(dfs_device_status)) { | ||
4665 | pr_err("Error creating device_status node\n"); | ||
4666 | dfs_device_status = NULL; | ||
4528 | } | 4667 | } |
4529 | } | 4668 | } |
4530 | 4669 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 3bffff5f670c..8e8334c9dd0f 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -129,9 +129,9 @@ enum { | |||
129 | MTIP_PF_EH_ACTIVE_BIT = 1, /* error handling */ | 129 | MTIP_PF_EH_ACTIVE_BIT = 1, /* error handling */ |
130 | MTIP_PF_SE_ACTIVE_BIT = 2, /* secure erase */ | 130 | MTIP_PF_SE_ACTIVE_BIT = 2, /* secure erase */ |
131 | MTIP_PF_DM_ACTIVE_BIT = 3, /* download microcde */ | 131 | MTIP_PF_DM_ACTIVE_BIT = 3, /* download microcde */ |
132 | MTIP_PF_PAUSE_IO = ((1 << MTIP_PF_IC_ACTIVE_BIT) | \ | 132 | MTIP_PF_PAUSE_IO = ((1 << MTIP_PF_IC_ACTIVE_BIT) | |
133 | (1 << MTIP_PF_EH_ACTIVE_BIT) | \ | 133 | (1 << MTIP_PF_EH_ACTIVE_BIT) | |
134 | (1 << MTIP_PF_SE_ACTIVE_BIT) | \ | 134 | (1 << MTIP_PF_SE_ACTIVE_BIT) | |
135 | (1 << MTIP_PF_DM_ACTIVE_BIT)), | 135 | (1 << MTIP_PF_DM_ACTIVE_BIT)), |
136 | 136 | ||
137 | MTIP_PF_SVC_THD_ACTIVE_BIT = 4, | 137 | MTIP_PF_SVC_THD_ACTIVE_BIT = 4, |
@@ -144,9 +144,9 @@ enum { | |||
144 | MTIP_DDF_REMOVE_PENDING_BIT = 1, | 144 | MTIP_DDF_REMOVE_PENDING_BIT = 1, |
145 | MTIP_DDF_OVER_TEMP_BIT = 2, | 145 | MTIP_DDF_OVER_TEMP_BIT = 2, |
146 | MTIP_DDF_WRITE_PROTECT_BIT = 3, | 146 | MTIP_DDF_WRITE_PROTECT_BIT = 3, |
147 | MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ | 147 | MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | |
148 | (1 << MTIP_DDF_SEC_LOCK_BIT) | \ | 148 | (1 << MTIP_DDF_SEC_LOCK_BIT) | |
149 | (1 << MTIP_DDF_OVER_TEMP_BIT) | \ | 149 | (1 << MTIP_DDF_OVER_TEMP_BIT) | |
150 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)), | 150 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)), |
151 | 151 | ||
152 | MTIP_DDF_CLEANUP_BIT = 5, | 152 | MTIP_DDF_CLEANUP_BIT = 5, |
@@ -180,7 +180,7 @@ struct mtip_work { | |||
180 | 180 | ||
181 | #define MTIP_TRIM_TIMEOUT_MS 240000 | 181 | #define MTIP_TRIM_TIMEOUT_MS 240000 |
182 | #define MTIP_MAX_TRIM_ENTRIES 8 | 182 | #define MTIP_MAX_TRIM_ENTRIES 8 |
183 | #define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8 | 183 | #define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8 |
184 | 184 | ||
185 | struct mtip_trim_entry { | 185 | struct mtip_trim_entry { |
186 | u32 lba; /* starting lba of region */ | 186 | u32 lba; /* starting lba of region */ |
@@ -501,6 +501,10 @@ struct driver_data { | |||
501 | atomic_t irq_workers_active; | 501 | atomic_t irq_workers_active; |
502 | 502 | ||
503 | int isr_binding; | 503 | int isr_binding; |
504 | |||
505 | struct list_head online_list; /* linkage for online list */ | ||
506 | |||
507 | struct list_head remove_list; /* linkage for removing list */ | ||
504 | }; | 508 | }; |
505 | 509 | ||
506 | #endif | 510 | #endif |
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 07fb2dfaae13..9dcefe40380b 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c | |||
@@ -135,6 +135,7 @@ static inline void _nvme_check_size(void) | |||
135 | BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096); | 135 | BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096); |
136 | BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096); | 136 | BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096); |
137 | BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); | 137 | BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); |
138 | BUILD_BUG_ON(sizeof(struct nvme_smart_log) != 512); | ||
138 | } | 139 | } |
139 | 140 | ||
140 | typedef void (*nvme_completion_fn)(struct nvme_dev *, void *, | 141 | typedef void (*nvme_completion_fn)(struct nvme_dev *, void *, |
@@ -237,7 +238,8 @@ static void *free_cmdid(struct nvme_queue *nvmeq, int cmdid, | |||
237 | *fn = special_completion; | 238 | *fn = special_completion; |
238 | return CMD_CTX_INVALID; | 239 | return CMD_CTX_INVALID; |
239 | } | 240 | } |
240 | *fn = info[cmdid].fn; | 241 | if (fn) |
242 | *fn = info[cmdid].fn; | ||
241 | ctx = info[cmdid].ctx; | 243 | ctx = info[cmdid].ctx; |
242 | info[cmdid].fn = special_completion; | 244 | info[cmdid].fn = special_completion; |
243 | info[cmdid].ctx = CMD_CTX_COMPLETED; | 245 | info[cmdid].ctx = CMD_CTX_COMPLETED; |
@@ -335,6 +337,7 @@ nvme_alloc_iod(unsigned nseg, unsigned nbytes, gfp_t gfp) | |||
335 | iod->offset = offsetof(struct nvme_iod, sg[nseg]); | 337 | iod->offset = offsetof(struct nvme_iod, sg[nseg]); |
336 | iod->npages = -1; | 338 | iod->npages = -1; |
337 | iod->length = nbytes; | 339 | iod->length = nbytes; |
340 | iod->nents = 0; | ||
338 | } | 341 | } |
339 | 342 | ||
340 | return iod; | 343 | return iod; |
@@ -375,7 +378,8 @@ static void bio_completion(struct nvme_dev *dev, void *ctx, | |||
375 | struct bio *bio = iod->private; | 378 | struct bio *bio = iod->private; |
376 | u16 status = le16_to_cpup(&cqe->status) >> 1; | 379 | u16 status = le16_to_cpup(&cqe->status) >> 1; |
377 | 380 | ||
378 | dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents, | 381 | if (iod->nents) |
382 | dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents, | ||
379 | bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 383 | bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
380 | nvme_free_iod(dev, iod); | 384 | nvme_free_iod(dev, iod); |
381 | if (status) { | 385 | if (status) { |
@@ -589,7 +593,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
589 | 593 | ||
590 | result = nvme_map_bio(nvmeq->q_dmadev, iod, bio, dma_dir, psegs); | 594 | result = nvme_map_bio(nvmeq->q_dmadev, iod, bio, dma_dir, psegs); |
591 | if (result < 0) | 595 | if (result < 0) |
592 | goto free_iod; | 596 | goto free_cmdid; |
593 | length = result; | 597 | length = result; |
594 | 598 | ||
595 | cmnd->rw.command_id = cmdid; | 599 | cmnd->rw.command_id = cmdid; |
@@ -609,6 +613,8 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
609 | 613 | ||
610 | return 0; | 614 | return 0; |
611 | 615 | ||
616 | free_cmdid: | ||
617 | free_cmdid(nvmeq, cmdid, NULL); | ||
612 | free_iod: | 618 | free_iod: |
613 | nvme_free_iod(nvmeq->dev, iod); | 619 | nvme_free_iod(nvmeq->dev, iod); |
614 | nomem: | 620 | nomem: |
@@ -835,8 +841,8 @@ static int nvme_identify(struct nvme_dev *dev, unsigned nsid, unsigned cns, | |||
835 | return nvme_submit_admin_cmd(dev, &c, NULL); | 841 | return nvme_submit_admin_cmd(dev, &c, NULL); |
836 | } | 842 | } |
837 | 843 | ||
838 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | 844 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, |
839 | unsigned nsid, dma_addr_t dma_addr) | 845 | dma_addr_t dma_addr, u32 *result) |
840 | { | 846 | { |
841 | struct nvme_command c; | 847 | struct nvme_command c; |
842 | 848 | ||
@@ -846,7 +852,7 @@ static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | |||
846 | c.features.prp1 = cpu_to_le64(dma_addr); | 852 | c.features.prp1 = cpu_to_le64(dma_addr); |
847 | c.features.fid = cpu_to_le32(fid); | 853 | c.features.fid = cpu_to_le32(fid); |
848 | 854 | ||
849 | return nvme_submit_admin_cmd(dev, &c, NULL); | 855 | return nvme_submit_admin_cmd(dev, &c, result); |
850 | } | 856 | } |
851 | 857 | ||
852 | static int nvme_set_features(struct nvme_dev *dev, unsigned fid, | 858 | static int nvme_set_features(struct nvme_dev *dev, unsigned fid, |
@@ -906,6 +912,10 @@ static void nvme_free_queue(struct nvme_dev *dev, int qid) | |||
906 | 912 | ||
907 | spin_lock_irq(&nvmeq->q_lock); | 913 | spin_lock_irq(&nvmeq->q_lock); |
908 | nvme_cancel_ios(nvmeq, false); | 914 | nvme_cancel_ios(nvmeq, false); |
915 | while (bio_list_peek(&nvmeq->sq_cong)) { | ||
916 | struct bio *bio = bio_list_pop(&nvmeq->sq_cong); | ||
917 | bio_endio(bio, -EIO); | ||
918 | } | ||
909 | spin_unlock_irq(&nvmeq->q_lock); | 919 | spin_unlock_irq(&nvmeq->q_lock); |
910 | 920 | ||
911 | irq_set_affinity_hint(vector, NULL); | 921 | irq_set_affinity_hint(vector, NULL); |
@@ -1230,12 +1240,17 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev, | |||
1230 | if (length != cmd.data_len) | 1240 | if (length != cmd.data_len) |
1231 | status = -ENOMEM; | 1241 | status = -ENOMEM; |
1232 | else | 1242 | else |
1233 | status = nvme_submit_admin_cmd(dev, &c, NULL); | 1243 | status = nvme_submit_admin_cmd(dev, &c, &cmd.result); |
1234 | 1244 | ||
1235 | if (cmd.data_len) { | 1245 | if (cmd.data_len) { |
1236 | nvme_unmap_user_pages(dev, cmd.opcode & 1, iod); | 1246 | nvme_unmap_user_pages(dev, cmd.opcode & 1, iod); |
1237 | nvme_free_iod(dev, iod); | 1247 | nvme_free_iod(dev, iod); |
1238 | } | 1248 | } |
1249 | |||
1250 | if (!status && copy_to_user(&ucmd->result, &cmd.result, | ||
1251 | sizeof(cmd.result))) | ||
1252 | status = -EFAULT; | ||
1253 | |||
1239 | return status; | 1254 | return status; |
1240 | } | 1255 | } |
1241 | 1256 | ||
@@ -1523,9 +1538,9 @@ static int nvme_dev_add(struct nvme_dev *dev) | |||
1523 | continue; | 1538 | continue; |
1524 | 1539 | ||
1525 | res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, | 1540 | res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, |
1526 | dma_addr + 4096); | 1541 | dma_addr + 4096, NULL); |
1527 | if (res) | 1542 | if (res) |
1528 | continue; | 1543 | memset(mem + 4096, 0, 4096); |
1529 | 1544 | ||
1530 | ns = nvme_alloc_ns(dev, i, mem, mem + 4096); | 1545 | ns = nvme_alloc_ns(dev, i, mem, mem + 4096); |
1531 | if (ns) | 1546 | if (ns) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 6c81a4c040b9..b7b7a88d9f68 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1264,6 +1264,32 @@ static bool obj_request_done_test(struct rbd_obj_request *obj_request) | |||
1264 | return atomic_read(&obj_request->done) != 0; | 1264 | return atomic_read(&obj_request->done) != 0; |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | static void | ||
1268 | rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request) | ||
1269 | { | ||
1270 | dout("%s: obj %p img %p result %d %llu/%llu\n", __func__, | ||
1271 | obj_request, obj_request->img_request, obj_request->result, | ||
1272 | obj_request->xferred, obj_request->length); | ||
1273 | /* | ||
1274 | * ENOENT means a hole in the image. We zero-fill the | ||
1275 | * entire length of the request. A short read also implies | ||
1276 | * zero-fill to the end of the request. Either way we | ||
1277 | * update the xferred count to indicate the whole request | ||
1278 | * was satisfied. | ||
1279 | */ | ||
1280 | BUG_ON(obj_request->type != OBJ_REQUEST_BIO); | ||
1281 | if (obj_request->result == -ENOENT) { | ||
1282 | zero_bio_chain(obj_request->bio_list, 0); | ||
1283 | obj_request->result = 0; | ||
1284 | obj_request->xferred = obj_request->length; | ||
1285 | } else if (obj_request->xferred < obj_request->length && | ||
1286 | !obj_request->result) { | ||
1287 | zero_bio_chain(obj_request->bio_list, obj_request->xferred); | ||
1288 | obj_request->xferred = obj_request->length; | ||
1289 | } | ||
1290 | obj_request_done_set(obj_request); | ||
1291 | } | ||
1292 | |||
1267 | static void rbd_obj_request_complete(struct rbd_obj_request *obj_request) | 1293 | static void rbd_obj_request_complete(struct rbd_obj_request *obj_request) |
1268 | { | 1294 | { |
1269 | dout("%s: obj %p cb %p\n", __func__, obj_request, | 1295 | dout("%s: obj %p cb %p\n", __func__, obj_request, |
@@ -1284,23 +1310,10 @@ static void rbd_osd_read_callback(struct rbd_obj_request *obj_request) | |||
1284 | { | 1310 | { |
1285 | dout("%s: obj %p result %d %llu/%llu\n", __func__, obj_request, | 1311 | dout("%s: obj %p result %d %llu/%llu\n", __func__, obj_request, |
1286 | obj_request->result, obj_request->xferred, obj_request->length); | 1312 | obj_request->result, obj_request->xferred, obj_request->length); |
1287 | /* | 1313 | if (obj_request->img_request) |
1288 | * ENOENT means a hole in the object. We zero-fill the | 1314 | rbd_img_obj_request_read_callback(obj_request); |
1289 | * entire length of the request. A short read also implies | 1315 | else |
1290 | * zero-fill to the end of the request. Either way we | 1316 | obj_request_done_set(obj_request); |
1291 | * update the xferred count to indicate the whole request | ||
1292 | * was satisfied. | ||
1293 | */ | ||
1294 | if (obj_request->result == -ENOENT) { | ||
1295 | zero_bio_chain(obj_request->bio_list, 0); | ||
1296 | obj_request->result = 0; | ||
1297 | obj_request->xferred = obj_request->length; | ||
1298 | } else if (obj_request->xferred < obj_request->length && | ||
1299 | !obj_request->result) { | ||
1300 | zero_bio_chain(obj_request->bio_list, obj_request->xferred); | ||
1301 | obj_request->xferred = obj_request->length; | ||
1302 | } | ||
1303 | obj_request_done_set(obj_request); | ||
1304 | } | 1317 | } |
1305 | 1318 | ||
1306 | static void rbd_osd_write_callback(struct rbd_obj_request *obj_request) | 1319 | static void rbd_osd_write_callback(struct rbd_obj_request *obj_request) |
@@ -1729,9 +1742,10 @@ static int rbd_img_request_submit(struct rbd_img_request *img_request) | |||
1729 | struct rbd_device *rbd_dev = img_request->rbd_dev; | 1742 | struct rbd_device *rbd_dev = img_request->rbd_dev; |
1730 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | 1743 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
1731 | struct rbd_obj_request *obj_request; | 1744 | struct rbd_obj_request *obj_request; |
1745 | struct rbd_obj_request *next_obj_request; | ||
1732 | 1746 | ||
1733 | dout("%s: img %p\n", __func__, img_request); | 1747 | dout("%s: img %p\n", __func__, img_request); |
1734 | for_each_obj_request(img_request, obj_request) { | 1748 | for_each_obj_request_safe(img_request, obj_request, next_obj_request) { |
1735 | int ret; | 1749 | int ret; |
1736 | 1750 | ||
1737 | obj_request->callback = rbd_img_obj_callback; | 1751 | obj_request->callback = rbd_img_obj_callback; |
diff --git a/drivers/block/rsxx/Makefile b/drivers/block/rsxx/Makefile index f35cd0b71f7b..b1c53c0aa450 100644 --- a/drivers/block/rsxx/Makefile +++ b/drivers/block/rsxx/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-$(CONFIG_BLK_DEV_RSXX) += rsxx.o | 1 | obj-$(CONFIG_BLK_DEV_RSXX) += rsxx.o |
2 | rsxx-y := config.o core.o cregs.o dev.o dma.o | 2 | rsxx-objs := config.o core.o cregs.o dev.o dma.o |
diff --git a/drivers/block/rsxx/config.c b/drivers/block/rsxx/config.c index a295e7e9ee41..10cd530d3e10 100644 --- a/drivers/block/rsxx/config.c +++ b/drivers/block/rsxx/config.c | |||
@@ -29,15 +29,13 @@ | |||
29 | #include "rsxx_priv.h" | 29 | #include "rsxx_priv.h" |
30 | #include "rsxx_cfg.h" | 30 | #include "rsxx_cfg.h" |
31 | 31 | ||
32 | static void initialize_config(void *config) | 32 | static void initialize_config(struct rsxx_card_cfg *cfg) |
33 | { | 33 | { |
34 | struct rsxx_card_cfg *cfg = config; | ||
35 | |||
36 | cfg->hdr.version = RSXX_CFG_VERSION; | 34 | cfg->hdr.version = RSXX_CFG_VERSION; |
37 | 35 | ||
38 | cfg->data.block_size = RSXX_HW_BLK_SIZE; | 36 | cfg->data.block_size = RSXX_HW_BLK_SIZE; |
39 | cfg->data.stripe_size = RSXX_HW_BLK_SIZE; | 37 | cfg->data.stripe_size = RSXX_HW_BLK_SIZE; |
40 | cfg->data.vendor_id = RSXX_VENDOR_ID_TMS_IBM; | 38 | cfg->data.vendor_id = RSXX_VENDOR_ID_IBM; |
41 | cfg->data.cache_order = (-1); | 39 | cfg->data.cache_order = (-1); |
42 | cfg->data.intr_coal.mode = RSXX_INTR_COAL_DISABLED; | 40 | cfg->data.intr_coal.mode = RSXX_INTR_COAL_DISABLED; |
43 | cfg->data.intr_coal.count = 0; | 41 | cfg->data.intr_coal.count = 0; |
@@ -181,7 +179,7 @@ int rsxx_load_config(struct rsxx_cardinfo *card) | |||
181 | } else { | 179 | } else { |
182 | dev_info(CARD_TO_DEV(card), | 180 | dev_info(CARD_TO_DEV(card), |
183 | "Initializing card configuration.\n"); | 181 | "Initializing card configuration.\n"); |
184 | initialize_config(card); | 182 | initialize_config(&card->config); |
185 | st = rsxx_save_config(card); | 183 | st = rsxx_save_config(card); |
186 | if (st) | 184 | if (st) |
187 | return st; | 185 | return st; |
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index e5162487686a..5af21f2db29c 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/reboot.h> | 30 | #include <linux/reboot.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
33 | #include <linux/delay.h> | ||
33 | 34 | ||
34 | #include <linux/genhd.h> | 35 | #include <linux/genhd.h> |
35 | #include <linux/idr.h> | 36 | #include <linux/idr.h> |
@@ -39,8 +40,8 @@ | |||
39 | 40 | ||
40 | #define NO_LEGACY 0 | 41 | #define NO_LEGACY 0 |
41 | 42 | ||
42 | MODULE_DESCRIPTION("IBM RamSan PCIe Flash SSD Device Driver"); | 43 | MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver"); |
43 | MODULE_AUTHOR("IBM <support@ramsan.com>"); | 44 | MODULE_AUTHOR("Joshua Morris/Philip Kelleher, IBM"); |
44 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
45 | MODULE_VERSION(DRIVER_VERSION); | 46 | MODULE_VERSION(DRIVER_VERSION); |
46 | 47 | ||
@@ -52,6 +53,13 @@ static DEFINE_IDA(rsxx_disk_ida); | |||
52 | static DEFINE_SPINLOCK(rsxx_ida_lock); | 53 | static DEFINE_SPINLOCK(rsxx_ida_lock); |
53 | 54 | ||
54 | /*----------------- Interrupt Control & Handling -------------------*/ | 55 | /*----------------- Interrupt Control & Handling -------------------*/ |
56 | |||
57 | static void rsxx_mask_interrupts(struct rsxx_cardinfo *card) | ||
58 | { | ||
59 | card->isr_mask = 0; | ||
60 | card->ier_mask = 0; | ||
61 | } | ||
62 | |||
55 | static void __enable_intr(unsigned int *mask, unsigned int intr) | 63 | static void __enable_intr(unsigned int *mask, unsigned int intr) |
56 | { | 64 | { |
57 | *mask |= intr; | 65 | *mask |= intr; |
@@ -71,7 +79,8 @@ static void __disable_intr(unsigned int *mask, unsigned int intr) | |||
71 | */ | 79 | */ |
72 | void rsxx_enable_ier(struct rsxx_cardinfo *card, unsigned int intr) | 80 | void rsxx_enable_ier(struct rsxx_cardinfo *card, unsigned int intr) |
73 | { | 81 | { |
74 | if (unlikely(card->halt)) | 82 | if (unlikely(card->halt) || |
83 | unlikely(card->eeh_state)) | ||
75 | return; | 84 | return; |
76 | 85 | ||
77 | __enable_intr(&card->ier_mask, intr); | 86 | __enable_intr(&card->ier_mask, intr); |
@@ -80,6 +89,9 @@ void rsxx_enable_ier(struct rsxx_cardinfo *card, unsigned int intr) | |||
80 | 89 | ||
81 | void rsxx_disable_ier(struct rsxx_cardinfo *card, unsigned int intr) | 90 | void rsxx_disable_ier(struct rsxx_cardinfo *card, unsigned int intr) |
82 | { | 91 | { |
92 | if (unlikely(card->eeh_state)) | ||
93 | return; | ||
94 | |||
83 | __disable_intr(&card->ier_mask, intr); | 95 | __disable_intr(&card->ier_mask, intr); |
84 | iowrite32(card->ier_mask, card->regmap + IER); | 96 | iowrite32(card->ier_mask, card->regmap + IER); |
85 | } | 97 | } |
@@ -87,7 +99,8 @@ void rsxx_disable_ier(struct rsxx_cardinfo *card, unsigned int intr) | |||
87 | void rsxx_enable_ier_and_isr(struct rsxx_cardinfo *card, | 99 | void rsxx_enable_ier_and_isr(struct rsxx_cardinfo *card, |
88 | unsigned int intr) | 100 | unsigned int intr) |
89 | { | 101 | { |
90 | if (unlikely(card->halt)) | 102 | if (unlikely(card->halt) || |
103 | unlikely(card->eeh_state)) | ||
91 | return; | 104 | return; |
92 | 105 | ||
93 | __enable_intr(&card->isr_mask, intr); | 106 | __enable_intr(&card->isr_mask, intr); |
@@ -97,6 +110,9 @@ void rsxx_enable_ier_and_isr(struct rsxx_cardinfo *card, | |||
97 | void rsxx_disable_ier_and_isr(struct rsxx_cardinfo *card, | 110 | void rsxx_disable_ier_and_isr(struct rsxx_cardinfo *card, |
98 | unsigned int intr) | 111 | unsigned int intr) |
99 | { | 112 | { |
113 | if (unlikely(card->eeh_state)) | ||
114 | return; | ||
115 | |||
100 | __disable_intr(&card->isr_mask, intr); | 116 | __disable_intr(&card->isr_mask, intr); |
101 | __disable_intr(&card->ier_mask, intr); | 117 | __disable_intr(&card->ier_mask, intr); |
102 | iowrite32(card->ier_mask, card->regmap + IER); | 118 | iowrite32(card->ier_mask, card->regmap + IER); |
@@ -115,6 +131,9 @@ static irqreturn_t rsxx_isr(int irq, void *pdata) | |||
115 | do { | 131 | do { |
116 | reread_isr = 0; | 132 | reread_isr = 0; |
117 | 133 | ||
134 | if (unlikely(card->eeh_state)) | ||
135 | break; | ||
136 | |||
118 | isr = ioread32(card->regmap + ISR); | 137 | isr = ioread32(card->regmap + ISR); |
119 | if (isr == 0xffffffff) { | 138 | if (isr == 0xffffffff) { |
120 | /* | 139 | /* |
@@ -161,9 +180,9 @@ static irqreturn_t rsxx_isr(int irq, void *pdata) | |||
161 | } | 180 | } |
162 | 181 | ||
163 | /*----------------- Card Event Handler -------------------*/ | 182 | /*----------------- Card Event Handler -------------------*/ |
164 | static char *rsxx_card_state_to_str(unsigned int state) | 183 | static const char * const rsxx_card_state_to_str(unsigned int state) |
165 | { | 184 | { |
166 | static char *state_strings[] = { | 185 | static const char * const state_strings[] = { |
167 | "Unknown", "Shutdown", "Starting", "Formatting", | 186 | "Unknown", "Shutdown", "Starting", "Formatting", |
168 | "Uninitialized", "Good", "Shutting Down", | 187 | "Uninitialized", "Good", "Shutting Down", |
169 | "Fault", "Read Only Fault", "dStroying" | 188 | "Fault", "Read Only Fault", "dStroying" |
@@ -304,6 +323,192 @@ static int card_shutdown(struct rsxx_cardinfo *card) | |||
304 | return 0; | 323 | return 0; |
305 | } | 324 | } |
306 | 325 | ||
326 | static int rsxx_eeh_frozen(struct pci_dev *dev) | ||
327 | { | ||
328 | struct rsxx_cardinfo *card = pci_get_drvdata(dev); | ||
329 | int i; | ||
330 | int st; | ||
331 | |||
332 | dev_warn(&dev->dev, "IBM FlashSystem PCI: preparing for slot reset.\n"); | ||
333 | |||
334 | card->eeh_state = 1; | ||
335 | rsxx_mask_interrupts(card); | ||
336 | |||
337 | /* | ||
338 | * We need to guarantee that the write for eeh_state and masking | ||
339 | * interrupts does not become reordered. This will prevent a possible | ||
340 | * race condition with the EEH code. | ||
341 | */ | ||
342 | wmb(); | ||
343 | |||
344 | pci_disable_device(dev); | ||
345 | |||
346 | st = rsxx_eeh_save_issued_dmas(card); | ||
347 | if (st) | ||
348 | return st; | ||
349 | |||
350 | rsxx_eeh_save_issued_creg(card); | ||
351 | |||
352 | for (i = 0; i < card->n_targets; i++) { | ||
353 | if (card->ctrl[i].status.buf) | ||
354 | pci_free_consistent(card->dev, STATUS_BUFFER_SIZE8, | ||
355 | card->ctrl[i].status.buf, | ||
356 | card->ctrl[i].status.dma_addr); | ||
357 | if (card->ctrl[i].cmd.buf) | ||
358 | pci_free_consistent(card->dev, COMMAND_BUFFER_SIZE8, | ||
359 | card->ctrl[i].cmd.buf, | ||
360 | card->ctrl[i].cmd.dma_addr); | ||
361 | } | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | static void rsxx_eeh_failure(struct pci_dev *dev) | ||
367 | { | ||
368 | struct rsxx_cardinfo *card = pci_get_drvdata(dev); | ||
369 | int i; | ||
370 | |||
371 | dev_err(&dev->dev, "IBM FlashSystem PCI: disabling failed card.\n"); | ||
372 | |||
373 | card->eeh_state = 1; | ||
374 | |||
375 | for (i = 0; i < card->n_targets; i++) | ||
376 | del_timer_sync(&card->ctrl[i].activity_timer); | ||
377 | |||
378 | rsxx_eeh_cancel_dmas(card); | ||
379 | } | ||
380 | |||
381 | static int rsxx_eeh_fifo_flush_poll(struct rsxx_cardinfo *card) | ||
382 | { | ||
383 | unsigned int status; | ||
384 | int iter = 0; | ||
385 | |||
386 | /* We need to wait for the hardware to reset */ | ||
387 | while (iter++ < 10) { | ||
388 | status = ioread32(card->regmap + PCI_RECONFIG); | ||
389 | |||
390 | if (status & RSXX_FLUSH_BUSY) { | ||
391 | ssleep(1); | ||
392 | continue; | ||
393 | } | ||
394 | |||
395 | if (status & RSXX_FLUSH_TIMEOUT) | ||
396 | dev_warn(CARD_TO_DEV(card), "HW: flash controller timeout\n"); | ||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | /* Hardware failed resetting itself. */ | ||
401 | return -1; | ||
402 | } | ||
403 | |||
404 | static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev, | ||
405 | enum pci_channel_state error) | ||
406 | { | ||
407 | int st; | ||
408 | |||
409 | if (dev->revision < RSXX_EEH_SUPPORT) | ||
410 | return PCI_ERS_RESULT_NONE; | ||
411 | |||
412 | if (error == pci_channel_io_perm_failure) { | ||
413 | rsxx_eeh_failure(dev); | ||
414 | return PCI_ERS_RESULT_DISCONNECT; | ||
415 | } | ||
416 | |||
417 | st = rsxx_eeh_frozen(dev); | ||
418 | if (st) { | ||
419 | dev_err(&dev->dev, "Slot reset setup failed\n"); | ||
420 | rsxx_eeh_failure(dev); | ||
421 | return PCI_ERS_RESULT_DISCONNECT; | ||
422 | } | ||
423 | |||
424 | return PCI_ERS_RESULT_NEED_RESET; | ||
425 | } | ||
426 | |||
427 | static pci_ers_result_t rsxx_slot_reset(struct pci_dev *dev) | ||
428 | { | ||
429 | struct rsxx_cardinfo *card = pci_get_drvdata(dev); | ||
430 | unsigned long flags; | ||
431 | int i; | ||
432 | int st; | ||
433 | |||
434 | dev_warn(&dev->dev, | ||
435 | "IBM FlashSystem PCI: recovering from slot reset.\n"); | ||
436 | |||
437 | st = pci_enable_device(dev); | ||
438 | if (st) | ||
439 | goto failed_hw_setup; | ||
440 | |||
441 | pci_set_master(dev); | ||
442 | |||
443 | st = rsxx_eeh_fifo_flush_poll(card); | ||
444 | if (st) | ||
445 | goto failed_hw_setup; | ||
446 | |||
447 | rsxx_dma_queue_reset(card); | ||
448 | |||
449 | for (i = 0; i < card->n_targets; i++) { | ||
450 | st = rsxx_hw_buffers_init(dev, &card->ctrl[i]); | ||
451 | if (st) | ||
452 | goto failed_hw_buffers_init; | ||
453 | } | ||
454 | |||
455 | if (card->config_valid) | ||
456 | rsxx_dma_configure(card); | ||
457 | |||
458 | /* Clears the ISR register from spurious interrupts */ | ||
459 | st = ioread32(card->regmap + ISR); | ||
460 | |||
461 | card->eeh_state = 0; | ||
462 | |||
463 | st = rsxx_eeh_remap_dmas(card); | ||
464 | if (st) | ||
465 | goto failed_remap_dmas; | ||
466 | |||
467 | spin_lock_irqsave(&card->irq_lock, flags); | ||
468 | if (card->n_targets & RSXX_MAX_TARGETS) | ||
469 | rsxx_enable_ier_and_isr(card, CR_INTR_ALL_G); | ||
470 | else | ||
471 | rsxx_enable_ier_and_isr(card, CR_INTR_ALL_C); | ||
472 | spin_unlock_irqrestore(&card->irq_lock, flags); | ||
473 | |||
474 | rsxx_kick_creg_queue(card); | ||
475 | |||
476 | for (i = 0; i < card->n_targets; i++) { | ||
477 | spin_lock(&card->ctrl[i].queue_lock); | ||
478 | if (list_empty(&card->ctrl[i].queue)) { | ||
479 | spin_unlock(&card->ctrl[i].queue_lock); | ||
480 | continue; | ||
481 | } | ||
482 | spin_unlock(&card->ctrl[i].queue_lock); | ||
483 | |||
484 | queue_work(card->ctrl[i].issue_wq, | ||
485 | &card->ctrl[i].issue_dma_work); | ||
486 | } | ||
487 | |||
488 | dev_info(&dev->dev, "IBM FlashSystem PCI: recovery complete.\n"); | ||
489 | |||
490 | return PCI_ERS_RESULT_RECOVERED; | ||
491 | |||
492 | failed_hw_buffers_init: | ||
493 | failed_remap_dmas: | ||
494 | for (i = 0; i < card->n_targets; i++) { | ||
495 | if (card->ctrl[i].status.buf) | ||
496 | pci_free_consistent(card->dev, | ||
497 | STATUS_BUFFER_SIZE8, | ||
498 | card->ctrl[i].status.buf, | ||
499 | card->ctrl[i].status.dma_addr); | ||
500 | if (card->ctrl[i].cmd.buf) | ||
501 | pci_free_consistent(card->dev, | ||
502 | COMMAND_BUFFER_SIZE8, | ||
503 | card->ctrl[i].cmd.buf, | ||
504 | card->ctrl[i].cmd.dma_addr); | ||
505 | } | ||
506 | failed_hw_setup: | ||
507 | rsxx_eeh_failure(dev); | ||
508 | return PCI_ERS_RESULT_DISCONNECT; | ||
509 | |||
510 | } | ||
511 | |||
307 | /*----------------- Driver Initialization & Setup -------------------*/ | 512 | /*----------------- Driver Initialization & Setup -------------------*/ |
308 | /* Returns: 0 if the driver is compatible with the device | 513 | /* Returns: 0 if the driver is compatible with the device |
309 | -1 if the driver is NOT compatible with the device */ | 514 | -1 if the driver is NOT compatible with the device */ |
@@ -383,6 +588,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, | |||
383 | 588 | ||
384 | spin_lock_init(&card->irq_lock); | 589 | spin_lock_init(&card->irq_lock); |
385 | card->halt = 0; | 590 | card->halt = 0; |
591 | card->eeh_state = 0; | ||
386 | 592 | ||
387 | spin_lock_irq(&card->irq_lock); | 593 | spin_lock_irq(&card->irq_lock); |
388 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); | 594 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); |
@@ -538,9 +744,6 @@ static void rsxx_pci_remove(struct pci_dev *dev) | |||
538 | rsxx_disable_ier_and_isr(card, CR_INTR_EVENT); | 744 | rsxx_disable_ier_and_isr(card, CR_INTR_EVENT); |
539 | spin_unlock_irqrestore(&card->irq_lock, flags); | 745 | spin_unlock_irqrestore(&card->irq_lock, flags); |
540 | 746 | ||
541 | /* Prevent work_structs from re-queuing themselves. */ | ||
542 | card->halt = 1; | ||
543 | |||
544 | cancel_work_sync(&card->event_work); | 747 | cancel_work_sync(&card->event_work); |
545 | 748 | ||
546 | rsxx_destroy_dev(card); | 749 | rsxx_destroy_dev(card); |
@@ -549,6 +752,10 @@ static void rsxx_pci_remove(struct pci_dev *dev) | |||
549 | spin_lock_irqsave(&card->irq_lock, flags); | 752 | spin_lock_irqsave(&card->irq_lock, flags); |
550 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); | 753 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); |
551 | spin_unlock_irqrestore(&card->irq_lock, flags); | 754 | spin_unlock_irqrestore(&card->irq_lock, flags); |
755 | |||
756 | /* Prevent work_structs from re-queuing themselves. */ | ||
757 | card->halt = 1; | ||
758 | |||
552 | free_irq(dev->irq, card); | 759 | free_irq(dev->irq, card); |
553 | 760 | ||
554 | if (!force_legacy) | 761 | if (!force_legacy) |
@@ -592,11 +799,14 @@ static void rsxx_pci_shutdown(struct pci_dev *dev) | |||
592 | card_shutdown(card); | 799 | card_shutdown(card); |
593 | } | 800 | } |
594 | 801 | ||
802 | static const struct pci_error_handlers rsxx_err_handler = { | ||
803 | .error_detected = rsxx_error_detected, | ||
804 | .slot_reset = rsxx_slot_reset, | ||
805 | }; | ||
806 | |||
595 | static DEFINE_PCI_DEVICE_TABLE(rsxx_pci_ids) = { | 807 | static DEFINE_PCI_DEVICE_TABLE(rsxx_pci_ids) = { |
596 | {PCI_DEVICE(PCI_VENDOR_ID_TMS_IBM, PCI_DEVICE_ID_RS70_FLASH)}, | 808 | {PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_FS70_FLASH)}, |
597 | {PCI_DEVICE(PCI_VENDOR_ID_TMS_IBM, PCI_DEVICE_ID_RS70D_FLASH)}, | 809 | {PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_FS80_FLASH)}, |
598 | {PCI_DEVICE(PCI_VENDOR_ID_TMS_IBM, PCI_DEVICE_ID_RS80_FLASH)}, | ||
599 | {PCI_DEVICE(PCI_VENDOR_ID_TMS_IBM, PCI_DEVICE_ID_RS81_FLASH)}, | ||
600 | {0,}, | 810 | {0,}, |
601 | }; | 811 | }; |
602 | 812 | ||
@@ -609,6 +819,7 @@ static struct pci_driver rsxx_pci_driver = { | |||
609 | .remove = rsxx_pci_remove, | 819 | .remove = rsxx_pci_remove, |
610 | .suspend = rsxx_pci_suspend, | 820 | .suspend = rsxx_pci_suspend, |
611 | .shutdown = rsxx_pci_shutdown, | 821 | .shutdown = rsxx_pci_shutdown, |
822 | .err_handler = &rsxx_err_handler, | ||
612 | }; | 823 | }; |
613 | 824 | ||
614 | static int __init rsxx_core_init(void) | 825 | static int __init rsxx_core_init(void) |
diff --git a/drivers/block/rsxx/cregs.c b/drivers/block/rsxx/cregs.c index 80bbe639fccd..4b5c020a0a65 100644 --- a/drivers/block/rsxx/cregs.c +++ b/drivers/block/rsxx/cregs.c | |||
@@ -58,7 +58,7 @@ static struct kmem_cache *creg_cmd_pool; | |||
58 | #error Unknown endianess!!! Aborting... | 58 | #error Unknown endianess!!! Aborting... |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | static void copy_to_creg_data(struct rsxx_cardinfo *card, | 61 | static int copy_to_creg_data(struct rsxx_cardinfo *card, |
62 | int cnt8, | 62 | int cnt8, |
63 | void *buf, | 63 | void *buf, |
64 | unsigned int stream) | 64 | unsigned int stream) |
@@ -66,6 +66,9 @@ static void copy_to_creg_data(struct rsxx_cardinfo *card, | |||
66 | int i = 0; | 66 | int i = 0; |
67 | u32 *data = buf; | 67 | u32 *data = buf; |
68 | 68 | ||
69 | if (unlikely(card->eeh_state)) | ||
70 | return -EIO; | ||
71 | |||
69 | for (i = 0; cnt8 > 0; i++, cnt8 -= 4) { | 72 | for (i = 0; cnt8 > 0; i++, cnt8 -= 4) { |
70 | /* | 73 | /* |
71 | * Firmware implementation makes it necessary to byte swap on | 74 | * Firmware implementation makes it necessary to byte swap on |
@@ -76,10 +79,12 @@ static void copy_to_creg_data(struct rsxx_cardinfo *card, | |||
76 | else | 79 | else |
77 | iowrite32(data[i], card->regmap + CREG_DATA(i)); | 80 | iowrite32(data[i], card->regmap + CREG_DATA(i)); |
78 | } | 81 | } |
82 | |||
83 | return 0; | ||
79 | } | 84 | } |
80 | 85 | ||
81 | 86 | ||
82 | static void copy_from_creg_data(struct rsxx_cardinfo *card, | 87 | static int copy_from_creg_data(struct rsxx_cardinfo *card, |
83 | int cnt8, | 88 | int cnt8, |
84 | void *buf, | 89 | void *buf, |
85 | unsigned int stream) | 90 | unsigned int stream) |
@@ -87,6 +92,9 @@ static void copy_from_creg_data(struct rsxx_cardinfo *card, | |||
87 | int i = 0; | 92 | int i = 0; |
88 | u32 *data = buf; | 93 | u32 *data = buf; |
89 | 94 | ||
95 | if (unlikely(card->eeh_state)) | ||
96 | return -EIO; | ||
97 | |||
90 | for (i = 0; cnt8 > 0; i++, cnt8 -= 4) { | 98 | for (i = 0; cnt8 > 0; i++, cnt8 -= 4) { |
91 | /* | 99 | /* |
92 | * Firmware implementation makes it necessary to byte swap on | 100 | * Firmware implementation makes it necessary to byte swap on |
@@ -97,41 +105,31 @@ static void copy_from_creg_data(struct rsxx_cardinfo *card, | |||
97 | else | 105 | else |
98 | data[i] = ioread32(card->regmap + CREG_DATA(i)); | 106 | data[i] = ioread32(card->regmap + CREG_DATA(i)); |
99 | } | 107 | } |
100 | } | ||
101 | |||
102 | static struct creg_cmd *pop_active_cmd(struct rsxx_cardinfo *card) | ||
103 | { | ||
104 | struct creg_cmd *cmd; | ||
105 | 108 | ||
106 | /* | 109 | return 0; |
107 | * Spin lock is needed because this can be called in atomic/interrupt | ||
108 | * context. | ||
109 | */ | ||
110 | spin_lock_bh(&card->creg_ctrl.lock); | ||
111 | cmd = card->creg_ctrl.active_cmd; | ||
112 | card->creg_ctrl.active_cmd = NULL; | ||
113 | spin_unlock_bh(&card->creg_ctrl.lock); | ||
114 | |||
115 | return cmd; | ||
116 | } | 110 | } |
117 | 111 | ||
118 | static void creg_issue_cmd(struct rsxx_cardinfo *card, struct creg_cmd *cmd) | 112 | static void creg_issue_cmd(struct rsxx_cardinfo *card, struct creg_cmd *cmd) |
119 | { | 113 | { |
114 | int st; | ||
115 | |||
116 | if (unlikely(card->eeh_state)) | ||
117 | return; | ||
118 | |||
120 | iowrite32(cmd->addr, card->regmap + CREG_ADD); | 119 | iowrite32(cmd->addr, card->regmap + CREG_ADD); |
121 | iowrite32(cmd->cnt8, card->regmap + CREG_CNT); | 120 | iowrite32(cmd->cnt8, card->regmap + CREG_CNT); |
122 | 121 | ||
123 | if (cmd->op == CREG_OP_WRITE) { | 122 | if (cmd->op == CREG_OP_WRITE) { |
124 | if (cmd->buf) | 123 | if (cmd->buf) { |
125 | copy_to_creg_data(card, cmd->cnt8, | 124 | st = copy_to_creg_data(card, cmd->cnt8, |
126 | cmd->buf, cmd->stream); | 125 | cmd->buf, cmd->stream); |
126 | if (st) | ||
127 | return; | ||
128 | } | ||
127 | } | 129 | } |
128 | 130 | ||
129 | /* | 131 | if (unlikely(card->eeh_state)) |
130 | * Data copy must complete before initiating the command. This is | 132 | return; |
131 | * needed for weakly ordered processors (i.e. PowerPC), so that all | ||
132 | * neccessary registers are written before we kick the hardware. | ||
133 | */ | ||
134 | wmb(); | ||
135 | 133 | ||
136 | /* Setting the valid bit will kick off the command. */ | 134 | /* Setting the valid bit will kick off the command. */ |
137 | iowrite32(cmd->op, card->regmap + CREG_CMD); | 135 | iowrite32(cmd->op, card->regmap + CREG_CMD); |
@@ -196,11 +194,11 @@ static int creg_queue_cmd(struct rsxx_cardinfo *card, | |||
196 | cmd->cb_private = cb_private; | 194 | cmd->cb_private = cb_private; |
197 | cmd->status = 0; | 195 | cmd->status = 0; |
198 | 196 | ||
199 | spin_lock(&card->creg_ctrl.lock); | 197 | spin_lock_bh(&card->creg_ctrl.lock); |
200 | list_add_tail(&cmd->list, &card->creg_ctrl.queue); | 198 | list_add_tail(&cmd->list, &card->creg_ctrl.queue); |
201 | card->creg_ctrl.q_depth++; | 199 | card->creg_ctrl.q_depth++; |
202 | creg_kick_queue(card); | 200 | creg_kick_queue(card); |
203 | spin_unlock(&card->creg_ctrl.lock); | 201 | spin_unlock_bh(&card->creg_ctrl.lock); |
204 | 202 | ||
205 | return 0; | 203 | return 0; |
206 | } | 204 | } |
@@ -210,7 +208,11 @@ static void creg_cmd_timed_out(unsigned long data) | |||
210 | struct rsxx_cardinfo *card = (struct rsxx_cardinfo *) data; | 208 | struct rsxx_cardinfo *card = (struct rsxx_cardinfo *) data; |
211 | struct creg_cmd *cmd; | 209 | struct creg_cmd *cmd; |
212 | 210 | ||
213 | cmd = pop_active_cmd(card); | 211 | spin_lock(&card->creg_ctrl.lock); |
212 | cmd = card->creg_ctrl.active_cmd; | ||
213 | card->creg_ctrl.active_cmd = NULL; | ||
214 | spin_unlock(&card->creg_ctrl.lock); | ||
215 | |||
214 | if (cmd == NULL) { | 216 | if (cmd == NULL) { |
215 | card->creg_ctrl.creg_stats.creg_timeout++; | 217 | card->creg_ctrl.creg_stats.creg_timeout++; |
216 | dev_warn(CARD_TO_DEV(card), | 218 | dev_warn(CARD_TO_DEV(card), |
@@ -247,7 +249,11 @@ static void creg_cmd_done(struct work_struct *work) | |||
247 | if (del_timer_sync(&card->creg_ctrl.cmd_timer) == 0) | 249 | if (del_timer_sync(&card->creg_ctrl.cmd_timer) == 0) |
248 | card->creg_ctrl.creg_stats.failed_cancel_timer++; | 250 | card->creg_ctrl.creg_stats.failed_cancel_timer++; |
249 | 251 | ||
250 | cmd = pop_active_cmd(card); | 252 | spin_lock_bh(&card->creg_ctrl.lock); |
253 | cmd = card->creg_ctrl.active_cmd; | ||
254 | card->creg_ctrl.active_cmd = NULL; | ||
255 | spin_unlock_bh(&card->creg_ctrl.lock); | ||
256 | |||
251 | if (cmd == NULL) { | 257 | if (cmd == NULL) { |
252 | dev_err(CARD_TO_DEV(card), | 258 | dev_err(CARD_TO_DEV(card), |
253 | "Spurious creg interrupt!\n"); | 259 | "Spurious creg interrupt!\n"); |
@@ -287,7 +293,7 @@ static void creg_cmd_done(struct work_struct *work) | |||
287 | goto creg_done; | 293 | goto creg_done; |
288 | } | 294 | } |
289 | 295 | ||
290 | copy_from_creg_data(card, cnt8, cmd->buf, cmd->stream); | 296 | st = copy_from_creg_data(card, cnt8, cmd->buf, cmd->stream); |
291 | } | 297 | } |
292 | 298 | ||
293 | creg_done: | 299 | creg_done: |
@@ -296,10 +302,10 @@ creg_done: | |||
296 | 302 | ||
297 | kmem_cache_free(creg_cmd_pool, cmd); | 303 | kmem_cache_free(creg_cmd_pool, cmd); |
298 | 304 | ||
299 | spin_lock(&card->creg_ctrl.lock); | 305 | spin_lock_bh(&card->creg_ctrl.lock); |
300 | card->creg_ctrl.active = 0; | 306 | card->creg_ctrl.active = 0; |
301 | creg_kick_queue(card); | 307 | creg_kick_queue(card); |
302 | spin_unlock(&card->creg_ctrl.lock); | 308 | spin_unlock_bh(&card->creg_ctrl.lock); |
303 | } | 309 | } |
304 | 310 | ||
305 | static void creg_reset(struct rsxx_cardinfo *card) | 311 | static void creg_reset(struct rsxx_cardinfo *card) |
@@ -324,7 +330,7 @@ static void creg_reset(struct rsxx_cardinfo *card) | |||
324 | "Resetting creg interface for recovery\n"); | 330 | "Resetting creg interface for recovery\n"); |
325 | 331 | ||
326 | /* Cancel outstanding commands */ | 332 | /* Cancel outstanding commands */ |
327 | spin_lock(&card->creg_ctrl.lock); | 333 | spin_lock_bh(&card->creg_ctrl.lock); |
328 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { | 334 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { |
329 | list_del(&cmd->list); | 335 | list_del(&cmd->list); |
330 | card->creg_ctrl.q_depth--; | 336 | card->creg_ctrl.q_depth--; |
@@ -345,7 +351,7 @@ static void creg_reset(struct rsxx_cardinfo *card) | |||
345 | 351 | ||
346 | card->creg_ctrl.active = 0; | 352 | card->creg_ctrl.active = 0; |
347 | } | 353 | } |
348 | spin_unlock(&card->creg_ctrl.lock); | 354 | spin_unlock_bh(&card->creg_ctrl.lock); |
349 | 355 | ||
350 | card->creg_ctrl.reset = 0; | 356 | card->creg_ctrl.reset = 0; |
351 | spin_lock_irqsave(&card->irq_lock, flags); | 357 | spin_lock_irqsave(&card->irq_lock, flags); |
@@ -399,12 +405,12 @@ static int __issue_creg_rw(struct rsxx_cardinfo *card, | |||
399 | return st; | 405 | return st; |
400 | 406 | ||
401 | /* | 407 | /* |
402 | * This timeout is neccessary for unresponsive hardware. The additional | 408 | * This timeout is necessary for unresponsive hardware. The additional |
403 | * 20 seconds to used to guarantee that each cregs requests has time to | 409 | * 20 seconds to used to guarantee that each cregs requests has time to |
404 | * complete. | 410 | * complete. |
405 | */ | 411 | */ |
406 | timeout = msecs_to_jiffies((CREG_TIMEOUT_MSEC * | 412 | timeout = msecs_to_jiffies(CREG_TIMEOUT_MSEC * |
407 | card->creg_ctrl.q_depth) + 20000); | 413 | card->creg_ctrl.q_depth + 20000); |
408 | 414 | ||
409 | /* | 415 | /* |
410 | * The creg interface is guaranteed to complete. It has a timeout | 416 | * The creg interface is guaranteed to complete. It has a timeout |
@@ -690,6 +696,32 @@ int rsxx_reg_access(struct rsxx_cardinfo *card, | |||
690 | return 0; | 696 | return 0; |
691 | } | 697 | } |
692 | 698 | ||
699 | void rsxx_eeh_save_issued_creg(struct rsxx_cardinfo *card) | ||
700 | { | ||
701 | struct creg_cmd *cmd = NULL; | ||
702 | |||
703 | cmd = card->creg_ctrl.active_cmd; | ||
704 | card->creg_ctrl.active_cmd = NULL; | ||
705 | |||
706 | if (cmd) { | ||
707 | del_timer_sync(&card->creg_ctrl.cmd_timer); | ||
708 | |||
709 | spin_lock_bh(&card->creg_ctrl.lock); | ||
710 | list_add(&cmd->list, &card->creg_ctrl.queue); | ||
711 | card->creg_ctrl.q_depth++; | ||
712 | card->creg_ctrl.active = 0; | ||
713 | spin_unlock_bh(&card->creg_ctrl.lock); | ||
714 | } | ||
715 | } | ||
716 | |||
717 | void rsxx_kick_creg_queue(struct rsxx_cardinfo *card) | ||
718 | { | ||
719 | spin_lock_bh(&card->creg_ctrl.lock); | ||
720 | if (!list_empty(&card->creg_ctrl.queue)) | ||
721 | creg_kick_queue(card); | ||
722 | spin_unlock_bh(&card->creg_ctrl.lock); | ||
723 | } | ||
724 | |||
693 | /*------------ Initialization & Setup --------------*/ | 725 | /*------------ Initialization & Setup --------------*/ |
694 | int rsxx_creg_setup(struct rsxx_cardinfo *card) | 726 | int rsxx_creg_setup(struct rsxx_cardinfo *card) |
695 | { | 727 | { |
@@ -712,7 +744,7 @@ void rsxx_creg_destroy(struct rsxx_cardinfo *card) | |||
712 | int cnt = 0; | 744 | int cnt = 0; |
713 | 745 | ||
714 | /* Cancel outstanding commands */ | 746 | /* Cancel outstanding commands */ |
715 | spin_lock(&card->creg_ctrl.lock); | 747 | spin_lock_bh(&card->creg_ctrl.lock); |
716 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { | 748 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { |
717 | list_del(&cmd->list); | 749 | list_del(&cmd->list); |
718 | if (cmd->cb) | 750 | if (cmd->cb) |
@@ -737,7 +769,7 @@ void rsxx_creg_destroy(struct rsxx_cardinfo *card) | |||
737 | "Canceled active creg command\n"); | 769 | "Canceled active creg command\n"); |
738 | kmem_cache_free(creg_cmd_pool, cmd); | 770 | kmem_cache_free(creg_cmd_pool, cmd); |
739 | } | 771 | } |
740 | spin_unlock(&card->creg_ctrl.lock); | 772 | spin_unlock_bh(&card->creg_ctrl.lock); |
741 | 773 | ||
742 | cancel_work_sync(&card->creg_ctrl.done_work); | 774 | cancel_work_sync(&card->creg_ctrl.done_work); |
743 | } | 775 | } |
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index 63176e67662f..0607513cfb41 100644 --- a/drivers/block/rsxx/dma.c +++ b/drivers/block/rsxx/dma.c | |||
@@ -28,7 +28,7 @@ | |||
28 | struct rsxx_dma { | 28 | struct rsxx_dma { |
29 | struct list_head list; | 29 | struct list_head list; |
30 | u8 cmd; | 30 | u8 cmd; |
31 | unsigned int laddr; /* Logical address on the ramsan */ | 31 | unsigned int laddr; /* Logical address */ |
32 | struct { | 32 | struct { |
33 | u32 off; | 33 | u32 off; |
34 | u32 cnt; | 34 | u32 cnt; |
@@ -81,9 +81,6 @@ enum rsxx_hw_status { | |||
81 | HW_STATUS_FAULT = 0x08, | 81 | HW_STATUS_FAULT = 0x08, |
82 | }; | 82 | }; |
83 | 83 | ||
84 | #define STATUS_BUFFER_SIZE8 4096 | ||
85 | #define COMMAND_BUFFER_SIZE8 4096 | ||
86 | |||
87 | static struct kmem_cache *rsxx_dma_pool; | 84 | static struct kmem_cache *rsxx_dma_pool; |
88 | 85 | ||
89 | struct dma_tracker { | 86 | struct dma_tracker { |
@@ -122,7 +119,7 @@ static unsigned int rsxx_get_dma_tgt(struct rsxx_cardinfo *card, u64 addr8) | |||
122 | return tgt; | 119 | return tgt; |
123 | } | 120 | } |
124 | 121 | ||
125 | static void rsxx_dma_queue_reset(struct rsxx_cardinfo *card) | 122 | void rsxx_dma_queue_reset(struct rsxx_cardinfo *card) |
126 | { | 123 | { |
127 | /* Reset all DMA Command/Status Queues */ | 124 | /* Reset all DMA Command/Status Queues */ |
128 | iowrite32(DMA_QUEUE_RESET, card->regmap + RESET); | 125 | iowrite32(DMA_QUEUE_RESET, card->regmap + RESET); |
@@ -210,7 +207,8 @@ static void dma_intr_coal_auto_tune(struct rsxx_cardinfo *card) | |||
210 | u32 q_depth = 0; | 207 | u32 q_depth = 0; |
211 | u32 intr_coal; | 208 | u32 intr_coal; |
212 | 209 | ||
213 | if (card->config.data.intr_coal.mode != RSXX_INTR_COAL_AUTO_TUNE) | 210 | if (card->config.data.intr_coal.mode != RSXX_INTR_COAL_AUTO_TUNE || |
211 | unlikely(card->eeh_state)) | ||
214 | return; | 212 | return; |
215 | 213 | ||
216 | for (i = 0; i < card->n_targets; i++) | 214 | for (i = 0; i < card->n_targets; i++) |
@@ -223,31 +221,26 @@ static void dma_intr_coal_auto_tune(struct rsxx_cardinfo *card) | |||
223 | } | 221 | } |
224 | 222 | ||
225 | /*----------------- RSXX DMA Handling -------------------*/ | 223 | /*----------------- RSXX DMA Handling -------------------*/ |
226 | static void rsxx_complete_dma(struct rsxx_cardinfo *card, | 224 | static void rsxx_complete_dma(struct rsxx_dma_ctrl *ctrl, |
227 | struct rsxx_dma *dma, | 225 | struct rsxx_dma *dma, |
228 | unsigned int status) | 226 | unsigned int status) |
229 | { | 227 | { |
230 | if (status & DMA_SW_ERR) | 228 | if (status & DMA_SW_ERR) |
231 | printk_ratelimited(KERN_ERR | 229 | ctrl->stats.dma_sw_err++; |
232 | "SW Error in DMA(cmd x%02x, laddr x%08x)\n", | ||
233 | dma->cmd, dma->laddr); | ||
234 | if (status & DMA_HW_FAULT) | 230 | if (status & DMA_HW_FAULT) |
235 | printk_ratelimited(KERN_ERR | 231 | ctrl->stats.dma_hw_fault++; |
236 | "HW Fault in DMA(cmd x%02x, laddr x%08x)\n", | ||
237 | dma->cmd, dma->laddr); | ||
238 | if (status & DMA_CANCELLED) | 232 | if (status & DMA_CANCELLED) |
239 | printk_ratelimited(KERN_ERR | 233 | ctrl->stats.dma_cancelled++; |
240 | "DMA Cancelled(cmd x%02x, laddr x%08x)\n", | ||
241 | dma->cmd, dma->laddr); | ||
242 | 234 | ||
243 | if (dma->dma_addr) | 235 | if (dma->dma_addr) |
244 | pci_unmap_page(card->dev, dma->dma_addr, get_dma_size(dma), | 236 | pci_unmap_page(ctrl->card->dev, dma->dma_addr, |
237 | get_dma_size(dma), | ||
245 | dma->cmd == HW_CMD_BLK_WRITE ? | 238 | dma->cmd == HW_CMD_BLK_WRITE ? |
246 | PCI_DMA_TODEVICE : | 239 | PCI_DMA_TODEVICE : |
247 | PCI_DMA_FROMDEVICE); | 240 | PCI_DMA_FROMDEVICE); |
248 | 241 | ||
249 | if (dma->cb) | 242 | if (dma->cb) |
250 | dma->cb(card, dma->cb_data, status ? 1 : 0); | 243 | dma->cb(ctrl->card, dma->cb_data, status ? 1 : 0); |
251 | 244 | ||
252 | kmem_cache_free(rsxx_dma_pool, dma); | 245 | kmem_cache_free(rsxx_dma_pool, dma); |
253 | } | 246 | } |
@@ -330,14 +323,15 @@ static void rsxx_handle_dma_error(struct rsxx_dma_ctrl *ctrl, | |||
330 | if (requeue_cmd) | 323 | if (requeue_cmd) |
331 | rsxx_requeue_dma(ctrl, dma); | 324 | rsxx_requeue_dma(ctrl, dma); |
332 | else | 325 | else |
333 | rsxx_complete_dma(ctrl->card, dma, status); | 326 | rsxx_complete_dma(ctrl, dma, status); |
334 | } | 327 | } |
335 | 328 | ||
336 | static void dma_engine_stalled(unsigned long data) | 329 | static void dma_engine_stalled(unsigned long data) |
337 | { | 330 | { |
338 | struct rsxx_dma_ctrl *ctrl = (struct rsxx_dma_ctrl *)data; | 331 | struct rsxx_dma_ctrl *ctrl = (struct rsxx_dma_ctrl *)data; |
339 | 332 | ||
340 | if (atomic_read(&ctrl->stats.hw_q_depth) == 0) | 333 | if (atomic_read(&ctrl->stats.hw_q_depth) == 0 || |
334 | unlikely(ctrl->card->eeh_state)) | ||
341 | return; | 335 | return; |
342 | 336 | ||
343 | if (ctrl->cmd.idx != ioread32(ctrl->regmap + SW_CMD_IDX)) { | 337 | if (ctrl->cmd.idx != ioread32(ctrl->regmap + SW_CMD_IDX)) { |
@@ -369,7 +363,8 @@ static void rsxx_issue_dmas(struct work_struct *work) | |||
369 | ctrl = container_of(work, struct rsxx_dma_ctrl, issue_dma_work); | 363 | ctrl = container_of(work, struct rsxx_dma_ctrl, issue_dma_work); |
370 | hw_cmd_buf = ctrl->cmd.buf; | 364 | hw_cmd_buf = ctrl->cmd.buf; |
371 | 365 | ||
372 | if (unlikely(ctrl->card->halt)) | 366 | if (unlikely(ctrl->card->halt) || |
367 | unlikely(ctrl->card->eeh_state)) | ||
373 | return; | 368 | return; |
374 | 369 | ||
375 | while (1) { | 370 | while (1) { |
@@ -397,7 +392,7 @@ static void rsxx_issue_dmas(struct work_struct *work) | |||
397 | */ | 392 | */ |
398 | if (unlikely(ctrl->card->dma_fault)) { | 393 | if (unlikely(ctrl->card->dma_fault)) { |
399 | push_tracker(ctrl->trackers, tag); | 394 | push_tracker(ctrl->trackers, tag); |
400 | rsxx_complete_dma(ctrl->card, dma, DMA_CANCELLED); | 395 | rsxx_complete_dma(ctrl, dma, DMA_CANCELLED); |
401 | continue; | 396 | continue; |
402 | } | 397 | } |
403 | 398 | ||
@@ -432,19 +427,15 @@ static void rsxx_issue_dmas(struct work_struct *work) | |||
432 | 427 | ||
433 | /* Let HW know we've queued commands. */ | 428 | /* Let HW know we've queued commands. */ |
434 | if (cmds_pending) { | 429 | if (cmds_pending) { |
435 | /* | ||
436 | * We must guarantee that the CPU writes to 'ctrl->cmd.buf' | ||
437 | * (which is in PCI-consistent system-memory) from the loop | ||
438 | * above make it into the coherency domain before the | ||
439 | * following PIO "trigger" updating the cmd.idx. A WMB is | ||
440 | * sufficient. We need not explicitly CPU cache-flush since | ||
441 | * the memory is a PCI-consistent (ie; coherent) mapping. | ||
442 | */ | ||
443 | wmb(); | ||
444 | |||
445 | atomic_add(cmds_pending, &ctrl->stats.hw_q_depth); | 430 | atomic_add(cmds_pending, &ctrl->stats.hw_q_depth); |
446 | mod_timer(&ctrl->activity_timer, | 431 | mod_timer(&ctrl->activity_timer, |
447 | jiffies + DMA_ACTIVITY_TIMEOUT); | 432 | jiffies + DMA_ACTIVITY_TIMEOUT); |
433 | |||
434 | if (unlikely(ctrl->card->eeh_state)) { | ||
435 | del_timer_sync(&ctrl->activity_timer); | ||
436 | return; | ||
437 | } | ||
438 | |||
448 | iowrite32(ctrl->cmd.idx, ctrl->regmap + SW_CMD_IDX); | 439 | iowrite32(ctrl->cmd.idx, ctrl->regmap + SW_CMD_IDX); |
449 | } | 440 | } |
450 | } | 441 | } |
@@ -463,7 +454,8 @@ static void rsxx_dma_done(struct work_struct *work) | |||
463 | hw_st_buf = ctrl->status.buf; | 454 | hw_st_buf = ctrl->status.buf; |
464 | 455 | ||
465 | if (unlikely(ctrl->card->halt) || | 456 | if (unlikely(ctrl->card->halt) || |
466 | unlikely(ctrl->card->dma_fault)) | 457 | unlikely(ctrl->card->dma_fault) || |
458 | unlikely(ctrl->card->eeh_state)) | ||
467 | return; | 459 | return; |
468 | 460 | ||
469 | count = le16_to_cpu(hw_st_buf[ctrl->status.idx].count); | 461 | count = le16_to_cpu(hw_st_buf[ctrl->status.idx].count); |
@@ -508,7 +500,7 @@ static void rsxx_dma_done(struct work_struct *work) | |||
508 | if (status) | 500 | if (status) |
509 | rsxx_handle_dma_error(ctrl, dma, status); | 501 | rsxx_handle_dma_error(ctrl, dma, status); |
510 | else | 502 | else |
511 | rsxx_complete_dma(ctrl->card, dma, 0); | 503 | rsxx_complete_dma(ctrl, dma, 0); |
512 | 504 | ||
513 | push_tracker(ctrl->trackers, tag); | 505 | push_tracker(ctrl->trackers, tag); |
514 | 506 | ||
@@ -727,20 +719,54 @@ bvec_err: | |||
727 | 719 | ||
728 | 720 | ||
729 | /*----------------- DMA Engine Initialization & Setup -------------------*/ | 721 | /*----------------- DMA Engine Initialization & Setup -------------------*/ |
722 | int rsxx_hw_buffers_init(struct pci_dev *dev, struct rsxx_dma_ctrl *ctrl) | ||
723 | { | ||
724 | ctrl->status.buf = pci_alloc_consistent(dev, STATUS_BUFFER_SIZE8, | ||
725 | &ctrl->status.dma_addr); | ||
726 | ctrl->cmd.buf = pci_alloc_consistent(dev, COMMAND_BUFFER_SIZE8, | ||
727 | &ctrl->cmd.dma_addr); | ||
728 | if (ctrl->status.buf == NULL || ctrl->cmd.buf == NULL) | ||
729 | return -ENOMEM; | ||
730 | |||
731 | memset(ctrl->status.buf, 0xac, STATUS_BUFFER_SIZE8); | ||
732 | iowrite32(lower_32_bits(ctrl->status.dma_addr), | ||
733 | ctrl->regmap + SB_ADD_LO); | ||
734 | iowrite32(upper_32_bits(ctrl->status.dma_addr), | ||
735 | ctrl->regmap + SB_ADD_HI); | ||
736 | |||
737 | memset(ctrl->cmd.buf, 0x83, COMMAND_BUFFER_SIZE8); | ||
738 | iowrite32(lower_32_bits(ctrl->cmd.dma_addr), ctrl->regmap + CB_ADD_LO); | ||
739 | iowrite32(upper_32_bits(ctrl->cmd.dma_addr), ctrl->regmap + CB_ADD_HI); | ||
740 | |||
741 | ctrl->status.idx = ioread32(ctrl->regmap + HW_STATUS_CNT); | ||
742 | if (ctrl->status.idx > RSXX_MAX_OUTSTANDING_CMDS) { | ||
743 | dev_crit(&dev->dev, "Failed reading status cnt x%x\n", | ||
744 | ctrl->status.idx); | ||
745 | return -EINVAL; | ||
746 | } | ||
747 | iowrite32(ctrl->status.idx, ctrl->regmap + HW_STATUS_CNT); | ||
748 | iowrite32(ctrl->status.idx, ctrl->regmap + SW_STATUS_CNT); | ||
749 | |||
750 | ctrl->cmd.idx = ioread32(ctrl->regmap + HW_CMD_IDX); | ||
751 | if (ctrl->cmd.idx > RSXX_MAX_OUTSTANDING_CMDS) { | ||
752 | dev_crit(&dev->dev, "Failed reading cmd cnt x%x\n", | ||
753 | ctrl->status.idx); | ||
754 | return -EINVAL; | ||
755 | } | ||
756 | iowrite32(ctrl->cmd.idx, ctrl->regmap + HW_CMD_IDX); | ||
757 | iowrite32(ctrl->cmd.idx, ctrl->regmap + SW_CMD_IDX); | ||
758 | |||
759 | return 0; | ||
760 | } | ||
761 | |||
730 | static int rsxx_dma_ctrl_init(struct pci_dev *dev, | 762 | static int rsxx_dma_ctrl_init(struct pci_dev *dev, |
731 | struct rsxx_dma_ctrl *ctrl) | 763 | struct rsxx_dma_ctrl *ctrl) |
732 | { | 764 | { |
733 | int i; | 765 | int i; |
766 | int st; | ||
734 | 767 | ||
735 | memset(&ctrl->stats, 0, sizeof(ctrl->stats)); | 768 | memset(&ctrl->stats, 0, sizeof(ctrl->stats)); |
736 | 769 | ||
737 | ctrl->status.buf = pci_alloc_consistent(dev, STATUS_BUFFER_SIZE8, | ||
738 | &ctrl->status.dma_addr); | ||
739 | ctrl->cmd.buf = pci_alloc_consistent(dev, COMMAND_BUFFER_SIZE8, | ||
740 | &ctrl->cmd.dma_addr); | ||
741 | if (ctrl->status.buf == NULL || ctrl->cmd.buf == NULL) | ||
742 | return -ENOMEM; | ||
743 | |||
744 | ctrl->trackers = vmalloc(DMA_TRACKER_LIST_SIZE8); | 770 | ctrl->trackers = vmalloc(DMA_TRACKER_LIST_SIZE8); |
745 | if (!ctrl->trackers) | 771 | if (!ctrl->trackers) |
746 | return -ENOMEM; | 772 | return -ENOMEM; |
@@ -770,35 +796,9 @@ static int rsxx_dma_ctrl_init(struct pci_dev *dev, | |||
770 | INIT_WORK(&ctrl->issue_dma_work, rsxx_issue_dmas); | 796 | INIT_WORK(&ctrl->issue_dma_work, rsxx_issue_dmas); |
771 | INIT_WORK(&ctrl->dma_done_work, rsxx_dma_done); | 797 | INIT_WORK(&ctrl->dma_done_work, rsxx_dma_done); |
772 | 798 | ||
773 | memset(ctrl->status.buf, 0xac, STATUS_BUFFER_SIZE8); | 799 | st = rsxx_hw_buffers_init(dev, ctrl); |
774 | iowrite32(lower_32_bits(ctrl->status.dma_addr), | 800 | if (st) |
775 | ctrl->regmap + SB_ADD_LO); | 801 | return st; |
776 | iowrite32(upper_32_bits(ctrl->status.dma_addr), | ||
777 | ctrl->regmap + SB_ADD_HI); | ||
778 | |||
779 | memset(ctrl->cmd.buf, 0x83, COMMAND_BUFFER_SIZE8); | ||
780 | iowrite32(lower_32_bits(ctrl->cmd.dma_addr), ctrl->regmap + CB_ADD_LO); | ||
781 | iowrite32(upper_32_bits(ctrl->cmd.dma_addr), ctrl->regmap + CB_ADD_HI); | ||
782 | |||
783 | ctrl->status.idx = ioread32(ctrl->regmap + HW_STATUS_CNT); | ||
784 | if (ctrl->status.idx > RSXX_MAX_OUTSTANDING_CMDS) { | ||
785 | dev_crit(&dev->dev, "Failed reading status cnt x%x\n", | ||
786 | ctrl->status.idx); | ||
787 | return -EINVAL; | ||
788 | } | ||
789 | iowrite32(ctrl->status.idx, ctrl->regmap + HW_STATUS_CNT); | ||
790 | iowrite32(ctrl->status.idx, ctrl->regmap + SW_STATUS_CNT); | ||
791 | |||
792 | ctrl->cmd.idx = ioread32(ctrl->regmap + HW_CMD_IDX); | ||
793 | if (ctrl->cmd.idx > RSXX_MAX_OUTSTANDING_CMDS) { | ||
794 | dev_crit(&dev->dev, "Failed reading cmd cnt x%x\n", | ||
795 | ctrl->status.idx); | ||
796 | return -EINVAL; | ||
797 | } | ||
798 | iowrite32(ctrl->cmd.idx, ctrl->regmap + HW_CMD_IDX); | ||
799 | iowrite32(ctrl->cmd.idx, ctrl->regmap + SW_CMD_IDX); | ||
800 | |||
801 | wmb(); | ||
802 | 802 | ||
803 | return 0; | 803 | return 0; |
804 | } | 804 | } |
@@ -834,7 +834,7 @@ static int rsxx_dma_stripe_setup(struct rsxx_cardinfo *card, | |||
834 | return 0; | 834 | return 0; |
835 | } | 835 | } |
836 | 836 | ||
837 | static int rsxx_dma_configure(struct rsxx_cardinfo *card) | 837 | int rsxx_dma_configure(struct rsxx_cardinfo *card) |
838 | { | 838 | { |
839 | u32 intr_coal; | 839 | u32 intr_coal; |
840 | 840 | ||
@@ -980,6 +980,103 @@ void rsxx_dma_destroy(struct rsxx_cardinfo *card) | |||
980 | } | 980 | } |
981 | } | 981 | } |
982 | 982 | ||
983 | int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) | ||
984 | { | ||
985 | int i; | ||
986 | int j; | ||
987 | int cnt; | ||
988 | struct rsxx_dma *dma; | ||
989 | struct list_head *issued_dmas; | ||
990 | |||
991 | issued_dmas = kzalloc(sizeof(*issued_dmas) * card->n_targets, | ||
992 | GFP_KERNEL); | ||
993 | if (!issued_dmas) | ||
994 | return -ENOMEM; | ||
995 | |||
996 | for (i = 0; i < card->n_targets; i++) { | ||
997 | INIT_LIST_HEAD(&issued_dmas[i]); | ||
998 | cnt = 0; | ||
999 | for (j = 0; j < RSXX_MAX_OUTSTANDING_CMDS; j++) { | ||
1000 | dma = get_tracker_dma(card->ctrl[i].trackers, j); | ||
1001 | if (dma == NULL) | ||
1002 | continue; | ||
1003 | |||
1004 | if (dma->cmd == HW_CMD_BLK_WRITE) | ||
1005 | card->ctrl[i].stats.writes_issued--; | ||
1006 | else if (dma->cmd == HW_CMD_BLK_DISCARD) | ||
1007 | card->ctrl[i].stats.discards_issued--; | ||
1008 | else | ||
1009 | card->ctrl[i].stats.reads_issued--; | ||
1010 | |||
1011 | list_add_tail(&dma->list, &issued_dmas[i]); | ||
1012 | push_tracker(card->ctrl[i].trackers, j); | ||
1013 | cnt++; | ||
1014 | } | ||
1015 | |||
1016 | spin_lock(&card->ctrl[i].queue_lock); | ||
1017 | list_splice(&issued_dmas[i], &card->ctrl[i].queue); | ||
1018 | |||
1019 | atomic_sub(cnt, &card->ctrl[i].stats.hw_q_depth); | ||
1020 | card->ctrl[i].stats.sw_q_depth += cnt; | ||
1021 | card->ctrl[i].e_cnt = 0; | ||
1022 | |||
1023 | list_for_each_entry(dma, &card->ctrl[i].queue, list) { | ||
1024 | if (dma->dma_addr) | ||
1025 | pci_unmap_page(card->dev, dma->dma_addr, | ||
1026 | get_dma_size(dma), | ||
1027 | dma->cmd == HW_CMD_BLK_WRITE ? | ||
1028 | PCI_DMA_TODEVICE : | ||
1029 | PCI_DMA_FROMDEVICE); | ||
1030 | } | ||
1031 | spin_unlock(&card->ctrl[i].queue_lock); | ||
1032 | } | ||
1033 | |||
1034 | kfree(issued_dmas); | ||
1035 | |||
1036 | return 0; | ||
1037 | } | ||
1038 | |||
1039 | void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card) | ||
1040 | { | ||
1041 | struct rsxx_dma *dma; | ||
1042 | struct rsxx_dma *tmp; | ||
1043 | int i; | ||
1044 | |||
1045 | for (i = 0; i < card->n_targets; i++) { | ||
1046 | spin_lock(&card->ctrl[i].queue_lock); | ||
1047 | list_for_each_entry_safe(dma, tmp, &card->ctrl[i].queue, list) { | ||
1048 | list_del(&dma->list); | ||
1049 | |||
1050 | rsxx_complete_dma(&card->ctrl[i], dma, DMA_CANCELLED); | ||
1051 | } | ||
1052 | spin_unlock(&card->ctrl[i].queue_lock); | ||
1053 | } | ||
1054 | } | ||
1055 | |||
1056 | int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card) | ||
1057 | { | ||
1058 | struct rsxx_dma *dma; | ||
1059 | int i; | ||
1060 | |||
1061 | for (i = 0; i < card->n_targets; i++) { | ||
1062 | spin_lock(&card->ctrl[i].queue_lock); | ||
1063 | list_for_each_entry(dma, &card->ctrl[i].queue, list) { | ||
1064 | dma->dma_addr = pci_map_page(card->dev, dma->page, | ||
1065 | dma->pg_off, get_dma_size(dma), | ||
1066 | dma->cmd == HW_CMD_BLK_WRITE ? | ||
1067 | PCI_DMA_TODEVICE : | ||
1068 | PCI_DMA_FROMDEVICE); | ||
1069 | if (!dma->dma_addr) { | ||
1070 | spin_unlock(&card->ctrl[i].queue_lock); | ||
1071 | kmem_cache_free(rsxx_dma_pool, dma); | ||
1072 | return -ENOMEM; | ||
1073 | } | ||
1074 | } | ||
1075 | spin_unlock(&card->ctrl[i].queue_lock); | ||
1076 | } | ||
1077 | |||
1078 | return 0; | ||
1079 | } | ||
983 | 1080 | ||
984 | int rsxx_dma_init(void) | 1081 | int rsxx_dma_init(void) |
985 | { | 1082 | { |
diff --git a/drivers/block/rsxx/rsxx.h b/drivers/block/rsxx/rsxx.h index 2e50b65902b7..24ba3642bd89 100644 --- a/drivers/block/rsxx/rsxx.h +++ b/drivers/block/rsxx/rsxx.h | |||
@@ -27,15 +27,17 @@ | |||
27 | 27 | ||
28 | /*----------------- IOCTL Definitions -------------------*/ | 28 | /*----------------- IOCTL Definitions -------------------*/ |
29 | 29 | ||
30 | #define RSXX_MAX_DATA 8 | ||
31 | |||
30 | struct rsxx_reg_access { | 32 | struct rsxx_reg_access { |
31 | __u32 addr; | 33 | __u32 addr; |
32 | __u32 cnt; | 34 | __u32 cnt; |
33 | __u32 stat; | 35 | __u32 stat; |
34 | __u32 stream; | 36 | __u32 stream; |
35 | __u32 data[8]; | 37 | __u32 data[RSXX_MAX_DATA]; |
36 | }; | 38 | }; |
37 | 39 | ||
38 | #define RSXX_MAX_REG_CNT (8 * (sizeof(__u32))) | 40 | #define RSXX_MAX_REG_CNT (RSXX_MAX_DATA * (sizeof(__u32))) |
39 | 41 | ||
40 | #define RSXX_IOC_MAGIC 'r' | 42 | #define RSXX_IOC_MAGIC 'r' |
41 | 43 | ||
diff --git a/drivers/block/rsxx/rsxx_cfg.h b/drivers/block/rsxx/rsxx_cfg.h index c025fe5fdb70..f384c943846d 100644 --- a/drivers/block/rsxx/rsxx_cfg.h +++ b/drivers/block/rsxx/rsxx_cfg.h | |||
@@ -58,7 +58,7 @@ struct rsxx_card_cfg { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | /* Vendor ID Values */ | 60 | /* Vendor ID Values */ |
61 | #define RSXX_VENDOR_ID_TMS_IBM 0 | 61 | #define RSXX_VENDOR_ID_IBM 0 |
62 | #define RSXX_VENDOR_ID_DSI 1 | 62 | #define RSXX_VENDOR_ID_DSI 1 |
63 | #define RSXX_VENDOR_COUNT 2 | 63 | #define RSXX_VENDOR_COUNT 2 |
64 | 64 | ||
diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h index a1ac907d8f4c..382e8bf5c03b 100644 --- a/drivers/block/rsxx/rsxx_priv.h +++ b/drivers/block/rsxx/rsxx_priv.h | |||
@@ -45,16 +45,13 @@ | |||
45 | 45 | ||
46 | struct proc_cmd; | 46 | struct proc_cmd; |
47 | 47 | ||
48 | #define PCI_VENDOR_ID_TMS_IBM 0x15B6 | 48 | #define PCI_DEVICE_ID_FS70_FLASH 0x04A9 |
49 | #define PCI_DEVICE_ID_RS70_FLASH 0x0019 | 49 | #define PCI_DEVICE_ID_FS80_FLASH 0x04AA |
50 | #define PCI_DEVICE_ID_RS70D_FLASH 0x001A | ||
51 | #define PCI_DEVICE_ID_RS80_FLASH 0x001C | ||
52 | #define PCI_DEVICE_ID_RS81_FLASH 0x001E | ||
53 | 50 | ||
54 | #define RS70_PCI_REV_SUPPORTED 4 | 51 | #define RS70_PCI_REV_SUPPORTED 4 |
55 | 52 | ||
56 | #define DRIVER_NAME "rsxx" | 53 | #define DRIVER_NAME "rsxx" |
57 | #define DRIVER_VERSION "3.7" | 54 | #define DRIVER_VERSION "4.0" |
58 | 55 | ||
59 | /* Block size is 4096 */ | 56 | /* Block size is 4096 */ |
60 | #define RSXX_HW_BLK_SHIFT 12 | 57 | #define RSXX_HW_BLK_SHIFT 12 |
@@ -67,6 +64,9 @@ struct proc_cmd; | |||
67 | #define RSXX_MAX_OUTSTANDING_CMDS 255 | 64 | #define RSXX_MAX_OUTSTANDING_CMDS 255 |
68 | #define RSXX_CS_IDX_MASK 0xff | 65 | #define RSXX_CS_IDX_MASK 0xff |
69 | 66 | ||
67 | #define STATUS_BUFFER_SIZE8 4096 | ||
68 | #define COMMAND_BUFFER_SIZE8 4096 | ||
69 | |||
70 | #define RSXX_MAX_TARGETS 8 | 70 | #define RSXX_MAX_TARGETS 8 |
71 | 71 | ||
72 | struct dma_tracker_list; | 72 | struct dma_tracker_list; |
@@ -91,6 +91,9 @@ struct rsxx_dma_stats { | |||
91 | u32 discards_failed; | 91 | u32 discards_failed; |
92 | u32 done_rescheduled; | 92 | u32 done_rescheduled; |
93 | u32 issue_rescheduled; | 93 | u32 issue_rescheduled; |
94 | u32 dma_sw_err; | ||
95 | u32 dma_hw_fault; | ||
96 | u32 dma_cancelled; | ||
94 | u32 sw_q_depth; /* Number of DMAs on the SW queue. */ | 97 | u32 sw_q_depth; /* Number of DMAs on the SW queue. */ |
95 | atomic_t hw_q_depth; /* Number of DMAs queued to HW. */ | 98 | atomic_t hw_q_depth; /* Number of DMAs queued to HW. */ |
96 | }; | 99 | }; |
@@ -116,6 +119,7 @@ struct rsxx_dma_ctrl { | |||
116 | struct rsxx_cardinfo { | 119 | struct rsxx_cardinfo { |
117 | struct pci_dev *dev; | 120 | struct pci_dev *dev; |
118 | unsigned int halt; | 121 | unsigned int halt; |
122 | unsigned int eeh_state; | ||
119 | 123 | ||
120 | void __iomem *regmap; | 124 | void __iomem *regmap; |
121 | spinlock_t irq_lock; | 125 | spinlock_t irq_lock; |
@@ -224,6 +228,7 @@ enum rsxx_pci_regmap { | |||
224 | PERF_RD512_HI = 0xac, | 228 | PERF_RD512_HI = 0xac, |
225 | PERF_WR512_LO = 0xb0, | 229 | PERF_WR512_LO = 0xb0, |
226 | PERF_WR512_HI = 0xb4, | 230 | PERF_WR512_HI = 0xb4, |
231 | PCI_RECONFIG = 0xb8, | ||
227 | }; | 232 | }; |
228 | 233 | ||
229 | enum rsxx_intr { | 234 | enum rsxx_intr { |
@@ -237,6 +242,8 @@ enum rsxx_intr { | |||
237 | CR_INTR_DMA5 = 0x00000080, | 242 | CR_INTR_DMA5 = 0x00000080, |
238 | CR_INTR_DMA6 = 0x00000100, | 243 | CR_INTR_DMA6 = 0x00000100, |
239 | CR_INTR_DMA7 = 0x00000200, | 244 | CR_INTR_DMA7 = 0x00000200, |
245 | CR_INTR_ALL_C = 0x0000003f, | ||
246 | CR_INTR_ALL_G = 0x000003ff, | ||
240 | CR_INTR_DMA_ALL = 0x000003f5, | 247 | CR_INTR_DMA_ALL = 0x000003f5, |
241 | CR_INTR_ALL = 0xffffffff, | 248 | CR_INTR_ALL = 0xffffffff, |
242 | }; | 249 | }; |
@@ -253,8 +260,14 @@ enum rsxx_pci_reset { | |||
253 | DMA_QUEUE_RESET = 0x00000001, | 260 | DMA_QUEUE_RESET = 0x00000001, |
254 | }; | 261 | }; |
255 | 262 | ||
263 | enum rsxx_hw_fifo_flush { | ||
264 | RSXX_FLUSH_BUSY = 0x00000002, | ||
265 | RSXX_FLUSH_TIMEOUT = 0x00000004, | ||
266 | }; | ||
267 | |||
256 | enum rsxx_pci_revision { | 268 | enum rsxx_pci_revision { |
257 | RSXX_DISCARD_SUPPORT = 2, | 269 | RSXX_DISCARD_SUPPORT = 2, |
270 | RSXX_EEH_SUPPORT = 3, | ||
258 | }; | 271 | }; |
259 | 272 | ||
260 | enum rsxx_creg_cmd { | 273 | enum rsxx_creg_cmd { |
@@ -360,11 +373,17 @@ int rsxx_dma_setup(struct rsxx_cardinfo *card); | |||
360 | void rsxx_dma_destroy(struct rsxx_cardinfo *card); | 373 | void rsxx_dma_destroy(struct rsxx_cardinfo *card); |
361 | int rsxx_dma_init(void); | 374 | int rsxx_dma_init(void); |
362 | void rsxx_dma_cleanup(void); | 375 | void rsxx_dma_cleanup(void); |
376 | void rsxx_dma_queue_reset(struct rsxx_cardinfo *card); | ||
377 | int rsxx_dma_configure(struct rsxx_cardinfo *card); | ||
363 | int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, | 378 | int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, |
364 | struct bio *bio, | 379 | struct bio *bio, |
365 | atomic_t *n_dmas, | 380 | atomic_t *n_dmas, |
366 | rsxx_dma_cb cb, | 381 | rsxx_dma_cb cb, |
367 | void *cb_data); | 382 | void *cb_data); |
383 | int rsxx_hw_buffers_init(struct pci_dev *dev, struct rsxx_dma_ctrl *ctrl); | ||
384 | int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card); | ||
385 | void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card); | ||
386 | int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card); | ||
368 | 387 | ||
369 | /***** cregs.c *****/ | 388 | /***** cregs.c *****/ |
370 | int rsxx_creg_write(struct rsxx_cardinfo *card, u32 addr, | 389 | int rsxx_creg_write(struct rsxx_cardinfo *card, u32 addr, |
@@ -389,10 +408,11 @@ int rsxx_creg_setup(struct rsxx_cardinfo *card); | |||
389 | void rsxx_creg_destroy(struct rsxx_cardinfo *card); | 408 | void rsxx_creg_destroy(struct rsxx_cardinfo *card); |
390 | int rsxx_creg_init(void); | 409 | int rsxx_creg_init(void); |
391 | void rsxx_creg_cleanup(void); | 410 | void rsxx_creg_cleanup(void); |
392 | |||
393 | int rsxx_reg_access(struct rsxx_cardinfo *card, | 411 | int rsxx_reg_access(struct rsxx_cardinfo *card, |
394 | struct rsxx_reg_access __user *ucmd, | 412 | struct rsxx_reg_access __user *ucmd, |
395 | int read); | 413 | int read); |
414 | void rsxx_eeh_save_issued_creg(struct rsxx_cardinfo *card); | ||
415 | void rsxx_kick_creg_queue(struct rsxx_cardinfo *card); | ||
396 | 416 | ||
397 | 417 | ||
398 | 418 | ||
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index de1f319f7bd7..dd5b2fed97e9 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -164,7 +164,7 @@ static void make_response(struct xen_blkif *blkif, u64 id, | |||
164 | 164 | ||
165 | #define foreach_grant_safe(pos, n, rbtree, node) \ | 165 | #define foreach_grant_safe(pos, n, rbtree, node) \ |
166 | for ((pos) = container_of(rb_first((rbtree)), typeof(*(pos)), node), \ | 166 | for ((pos) = container_of(rb_first((rbtree)), typeof(*(pos)), node), \ |
167 | (n) = rb_next(&(pos)->node); \ | 167 | (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL; \ |
168 | &(pos)->node != NULL; \ | 168 | &(pos)->node != NULL; \ |
169 | (pos) = container_of(n, typeof(*(pos)), node), \ | 169 | (pos) = container_of(n, typeof(*(pos)), node), \ |
170 | (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL) | 170 | (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL) |
@@ -381,8 +381,8 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id) | |||
381 | 381 | ||
382 | static void print_stats(struct xen_blkif *blkif) | 382 | static void print_stats(struct xen_blkif *blkif) |
383 | { | 383 | { |
384 | pr_info("xen-blkback (%s): oo %3d | rd %4d | wr %4d | f %4d" | 384 | pr_info("xen-blkback (%s): oo %3llu | rd %4llu | wr %4llu | f %4llu" |
385 | " | ds %4d\n", | 385 | " | ds %4llu\n", |
386 | current->comm, blkif->st_oo_req, | 386 | current->comm, blkif->st_oo_req, |
387 | blkif->st_rd_req, blkif->st_wr_req, | 387 | blkif->st_rd_req, blkif->st_wr_req, |
388 | blkif->st_f_req, blkif->st_ds_req); | 388 | blkif->st_f_req, blkif->st_ds_req); |
@@ -442,7 +442,7 @@ int xen_blkif_schedule(void *arg) | |||
442 | } | 442 | } |
443 | 443 | ||
444 | struct seg_buf { | 444 | struct seg_buf { |
445 | unsigned long buf; | 445 | unsigned int offset; |
446 | unsigned int nsec; | 446 | unsigned int nsec; |
447 | }; | 447 | }; |
448 | /* | 448 | /* |
@@ -621,30 +621,21 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
621 | * If this is a new persistent grant | 621 | * If this is a new persistent grant |
622 | * save the handler | 622 | * save the handler |
623 | */ | 623 | */ |
624 | persistent_gnts[i]->handle = map[j].handle; | 624 | persistent_gnts[i]->handle = map[j++].handle; |
625 | persistent_gnts[i]->dev_bus_addr = | ||
626 | map[j++].dev_bus_addr; | ||
627 | } | 625 | } |
628 | pending_handle(pending_req, i) = | 626 | pending_handle(pending_req, i) = |
629 | persistent_gnts[i]->handle; | 627 | persistent_gnts[i]->handle; |
630 | 628 | ||
631 | if (ret) | 629 | if (ret) |
632 | continue; | 630 | continue; |
633 | |||
634 | seg[i].buf = persistent_gnts[i]->dev_bus_addr | | ||
635 | (req->u.rw.seg[i].first_sect << 9); | ||
636 | } else { | 631 | } else { |
637 | pending_handle(pending_req, i) = map[j].handle; | 632 | pending_handle(pending_req, i) = map[j++].handle; |
638 | bitmap_set(pending_req->unmap_seg, i, 1); | 633 | bitmap_set(pending_req->unmap_seg, i, 1); |
639 | 634 | ||
640 | if (ret) { | 635 | if (ret) |
641 | j++; | ||
642 | continue; | 636 | continue; |
643 | } | ||
644 | |||
645 | seg[i].buf = map[j++].dev_bus_addr | | ||
646 | (req->u.rw.seg[i].first_sect << 9); | ||
647 | } | 637 | } |
638 | seg[i].offset = (req->u.rw.seg[i].first_sect << 9); | ||
648 | } | 639 | } |
649 | return ret; | 640 | return ret; |
650 | } | 641 | } |
@@ -679,6 +670,16 @@ static int dispatch_discard_io(struct xen_blkif *blkif, | |||
679 | return err; | 670 | return err; |
680 | } | 671 | } |
681 | 672 | ||
673 | static int dispatch_other_io(struct xen_blkif *blkif, | ||
674 | struct blkif_request *req, | ||
675 | struct pending_req *pending_req) | ||
676 | { | ||
677 | free_req(pending_req); | ||
678 | make_response(blkif, req->u.other.id, req->operation, | ||
679 | BLKIF_RSP_EOPNOTSUPP); | ||
680 | return -EIO; | ||
681 | } | ||
682 | |||
682 | static void xen_blk_drain_io(struct xen_blkif *blkif) | 683 | static void xen_blk_drain_io(struct xen_blkif *blkif) |
683 | { | 684 | { |
684 | atomic_set(&blkif->drain, 1); | 685 | atomic_set(&blkif->drain, 1); |
@@ -800,17 +801,30 @@ __do_block_io_op(struct xen_blkif *blkif) | |||
800 | 801 | ||
801 | /* Apply all sanity checks to /private copy/ of request. */ | 802 | /* Apply all sanity checks to /private copy/ of request. */ |
802 | barrier(); | 803 | barrier(); |
803 | if (unlikely(req.operation == BLKIF_OP_DISCARD)) { | 804 | |
805 | switch (req.operation) { | ||
806 | case BLKIF_OP_READ: | ||
807 | case BLKIF_OP_WRITE: | ||
808 | case BLKIF_OP_WRITE_BARRIER: | ||
809 | case BLKIF_OP_FLUSH_DISKCACHE: | ||
810 | if (dispatch_rw_block_io(blkif, &req, pending_req)) | ||
811 | goto done; | ||
812 | break; | ||
813 | case BLKIF_OP_DISCARD: | ||
804 | free_req(pending_req); | 814 | free_req(pending_req); |
805 | if (dispatch_discard_io(blkif, &req)) | 815 | if (dispatch_discard_io(blkif, &req)) |
806 | break; | 816 | goto done; |
807 | } else if (dispatch_rw_block_io(blkif, &req, pending_req)) | ||
808 | break; | 817 | break; |
818 | default: | ||
819 | if (dispatch_other_io(blkif, &req, pending_req)) | ||
820 | goto done; | ||
821 | break; | ||
822 | } | ||
809 | 823 | ||
810 | /* Yield point for this unbounded loop. */ | 824 | /* Yield point for this unbounded loop. */ |
811 | cond_resched(); | 825 | cond_resched(); |
812 | } | 826 | } |
813 | 827 | done: | |
814 | return more_to_do; | 828 | return more_to_do; |
815 | } | 829 | } |
816 | 830 | ||
@@ -904,7 +918,8 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
904 | pr_debug(DRV_PFX "access denied: %s of [%llu,%llu] on dev=%04x\n", | 918 | pr_debug(DRV_PFX "access denied: %s of [%llu,%llu] on dev=%04x\n", |
905 | operation == READ ? "read" : "write", | 919 | operation == READ ? "read" : "write", |
906 | preq.sector_number, | 920 | preq.sector_number, |
907 | preq.sector_number + preq.nr_sects, preq.dev); | 921 | preq.sector_number + preq.nr_sects, |
922 | blkif->vbd.pdevice); | ||
908 | goto fail_response; | 923 | goto fail_response; |
909 | } | 924 | } |
910 | 925 | ||
@@ -947,7 +962,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
947 | (bio_add_page(bio, | 962 | (bio_add_page(bio, |
948 | pages[i], | 963 | pages[i], |
949 | seg[i].nsec << 9, | 964 | seg[i].nsec << 9, |
950 | seg[i].buf & ~PAGE_MASK) == 0)) { | 965 | seg[i].offset) == 0)) { |
951 | 966 | ||
952 | bio = bio_alloc(GFP_KERNEL, nseg-i); | 967 | bio = bio_alloc(GFP_KERNEL, nseg-i); |
953 | if (unlikely(bio == NULL)) | 968 | if (unlikely(bio == NULL)) |
@@ -977,13 +992,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
977 | bio->bi_end_io = end_block_io_op; | 992 | bio->bi_end_io = end_block_io_op; |
978 | } | 993 | } |
979 | 994 | ||
980 | /* | ||
981 | * We set it one so that the last submit_bio does not have to call | ||
982 | * atomic_inc. | ||
983 | */ | ||
984 | atomic_set(&pending_req->pendcnt, nbio); | 995 | atomic_set(&pending_req->pendcnt, nbio); |
985 | |||
986 | /* Get a reference count for the disk queue and start sending I/O */ | ||
987 | blk_start_plug(&plug); | 996 | blk_start_plug(&plug); |
988 | 997 | ||
989 | for (i = 0; i < nbio; i++) | 998 | for (i = 0; i < nbio; i++) |
@@ -1011,6 +1020,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
1011 | fail_put_bio: | 1020 | fail_put_bio: |
1012 | for (i = 0; i < nbio; i++) | 1021 | for (i = 0; i < nbio; i++) |
1013 | bio_put(biolist[i]); | 1022 | bio_put(biolist[i]); |
1023 | atomic_set(&pending_req->pendcnt, 1); | ||
1014 | __end_block_io_op(pending_req, -EINVAL); | 1024 | __end_block_io_op(pending_req, -EINVAL); |
1015 | msleep(1); /* back off a bit */ | 1025 | msleep(1); /* back off a bit */ |
1016 | return -EIO; | 1026 | return -EIO; |
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 6072390c7f57..60103e2517ba 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -77,11 +77,18 @@ struct blkif_x86_32_request_discard { | |||
77 | uint64_t nr_sectors; | 77 | uint64_t nr_sectors; |
78 | } __attribute__((__packed__)); | 78 | } __attribute__((__packed__)); |
79 | 79 | ||
80 | struct blkif_x86_32_request_other { | ||
81 | uint8_t _pad1; | ||
82 | blkif_vdev_t _pad2; | ||
83 | uint64_t id; /* private guest value, echoed in resp */ | ||
84 | } __attribute__((__packed__)); | ||
85 | |||
80 | struct blkif_x86_32_request { | 86 | struct blkif_x86_32_request { |
81 | uint8_t operation; /* BLKIF_OP_??? */ | 87 | uint8_t operation; /* BLKIF_OP_??? */ |
82 | union { | 88 | union { |
83 | struct blkif_x86_32_request_rw rw; | 89 | struct blkif_x86_32_request_rw rw; |
84 | struct blkif_x86_32_request_discard discard; | 90 | struct blkif_x86_32_request_discard discard; |
91 | struct blkif_x86_32_request_other other; | ||
85 | } u; | 92 | } u; |
86 | } __attribute__((__packed__)); | 93 | } __attribute__((__packed__)); |
87 | 94 | ||
@@ -113,11 +120,19 @@ struct blkif_x86_64_request_discard { | |||
113 | uint64_t nr_sectors; | 120 | uint64_t nr_sectors; |
114 | } __attribute__((__packed__)); | 121 | } __attribute__((__packed__)); |
115 | 122 | ||
123 | struct blkif_x86_64_request_other { | ||
124 | uint8_t _pad1; | ||
125 | blkif_vdev_t _pad2; | ||
126 | uint32_t _pad3; /* offsetof(blkif_..,u.discard.id)==8 */ | ||
127 | uint64_t id; /* private guest value, echoed in resp */ | ||
128 | } __attribute__((__packed__)); | ||
129 | |||
116 | struct blkif_x86_64_request { | 130 | struct blkif_x86_64_request { |
117 | uint8_t operation; /* BLKIF_OP_??? */ | 131 | uint8_t operation; /* BLKIF_OP_??? */ |
118 | union { | 132 | union { |
119 | struct blkif_x86_64_request_rw rw; | 133 | struct blkif_x86_64_request_rw rw; |
120 | struct blkif_x86_64_request_discard discard; | 134 | struct blkif_x86_64_request_discard discard; |
135 | struct blkif_x86_64_request_other other; | ||
121 | } u; | 136 | } u; |
122 | } __attribute__((__packed__)); | 137 | } __attribute__((__packed__)); |
123 | 138 | ||
@@ -172,7 +187,6 @@ struct persistent_gnt { | |||
172 | struct page *page; | 187 | struct page *page; |
173 | grant_ref_t gnt; | 188 | grant_ref_t gnt; |
174 | grant_handle_t handle; | 189 | grant_handle_t handle; |
175 | uint64_t dev_bus_addr; | ||
176 | struct rb_node node; | 190 | struct rb_node node; |
177 | }; | 191 | }; |
178 | 192 | ||
@@ -208,13 +222,13 @@ struct xen_blkif { | |||
208 | 222 | ||
209 | /* statistics */ | 223 | /* statistics */ |
210 | unsigned long st_print; | 224 | unsigned long st_print; |
211 | int st_rd_req; | 225 | unsigned long long st_rd_req; |
212 | int st_wr_req; | 226 | unsigned long long st_wr_req; |
213 | int st_oo_req; | 227 | unsigned long long st_oo_req; |
214 | int st_f_req; | 228 | unsigned long long st_f_req; |
215 | int st_ds_req; | 229 | unsigned long long st_ds_req; |
216 | int st_rd_sect; | 230 | unsigned long long st_rd_sect; |
217 | int st_wr_sect; | 231 | unsigned long long st_wr_sect; |
218 | 232 | ||
219 | wait_queue_head_t waiting_to_free; | 233 | wait_queue_head_t waiting_to_free; |
220 | }; | 234 | }; |
@@ -278,6 +292,11 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, | |||
278 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 292 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
279 | break; | 293 | break; |
280 | default: | 294 | default: |
295 | /* | ||
296 | * Don't know how to translate this op. Only get the | ||
297 | * ID so failure can be reported to the frontend. | ||
298 | */ | ||
299 | dst->u.other.id = src->u.other.id; | ||
281 | break; | 300 | break; |
282 | } | 301 | } |
283 | } | 302 | } |
@@ -309,6 +328,11 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, | |||
309 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 328 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
310 | break; | 329 | break; |
311 | default: | 330 | default: |
331 | /* | ||
332 | * Don't know how to translate this op. Only get the | ||
333 | * ID so failure can be reported to the frontend. | ||
334 | */ | ||
335 | dst->u.other.id = src->u.other.id; | ||
312 | break; | 336 | break; |
313 | } | 337 | } |
314 | } | 338 | } |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 5e237f630c47..8bfd1bcf95ec 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -230,13 +230,13 @@ int __init xen_blkif_interface_init(void) | |||
230 | } \ | 230 | } \ |
231 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) | 231 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) |
232 | 232 | ||
233 | VBD_SHOW(oo_req, "%d\n", be->blkif->st_oo_req); | 233 | VBD_SHOW(oo_req, "%llu\n", be->blkif->st_oo_req); |
234 | VBD_SHOW(rd_req, "%d\n", be->blkif->st_rd_req); | 234 | VBD_SHOW(rd_req, "%llu\n", be->blkif->st_rd_req); |
235 | VBD_SHOW(wr_req, "%d\n", be->blkif->st_wr_req); | 235 | VBD_SHOW(wr_req, "%llu\n", be->blkif->st_wr_req); |
236 | VBD_SHOW(f_req, "%d\n", be->blkif->st_f_req); | 236 | VBD_SHOW(f_req, "%llu\n", be->blkif->st_f_req); |
237 | VBD_SHOW(ds_req, "%d\n", be->blkif->st_ds_req); | 237 | VBD_SHOW(ds_req, "%llu\n", be->blkif->st_ds_req); |
238 | VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect); | 238 | VBD_SHOW(rd_sect, "%llu\n", be->blkif->st_rd_sect); |
239 | VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect); | 239 | VBD_SHOW(wr_sect, "%llu\n", be->blkif->st_wr_sect); |
240 | 240 | ||
241 | static struct attribute *xen_vbdstat_attrs[] = { | 241 | static struct attribute *xen_vbdstat_attrs[] = { |
242 | &dev_attr_oo_req.attr, | 242 | &dev_attr_oo_req.attr, |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index c3dae2e0f290..a894f88762d8 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/scatterlist.h> | 45 | #include <linux/scatterlist.h> |
46 | #include <linux/bitmap.h> | 46 | #include <linux/bitmap.h> |
47 | #include <linux/llist.h> | 47 | #include <linux/list.h> |
48 | 48 | ||
49 | #include <xen/xen.h> | 49 | #include <xen/xen.h> |
50 | #include <xen/xenbus.h> | 50 | #include <xen/xenbus.h> |
@@ -68,13 +68,12 @@ enum blkif_state { | |||
68 | struct grant { | 68 | struct grant { |
69 | grant_ref_t gref; | 69 | grant_ref_t gref; |
70 | unsigned long pfn; | 70 | unsigned long pfn; |
71 | struct llist_node node; | 71 | struct list_head node; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct blk_shadow { | 74 | struct blk_shadow { |
75 | struct blkif_request req; | 75 | struct blkif_request req; |
76 | struct request *request; | 76 | struct request *request; |
77 | unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
78 | struct grant *grants_used[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 77 | struct grant *grants_used[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
79 | }; | 78 | }; |
80 | 79 | ||
@@ -105,7 +104,7 @@ struct blkfront_info | |||
105 | struct work_struct work; | 104 | struct work_struct work; |
106 | struct gnttab_free_callback callback; | 105 | struct gnttab_free_callback callback; |
107 | struct blk_shadow shadow[BLK_RING_SIZE]; | 106 | struct blk_shadow shadow[BLK_RING_SIZE]; |
108 | struct llist_head persistent_gnts; | 107 | struct list_head persistent_gnts; |
109 | unsigned int persistent_gnts_c; | 108 | unsigned int persistent_gnts_c; |
110 | unsigned long shadow_free; | 109 | unsigned long shadow_free; |
111 | unsigned int feature_flush; | 110 | unsigned int feature_flush; |
@@ -165,6 +164,69 @@ static int add_id_to_freelist(struct blkfront_info *info, | |||
165 | return 0; | 164 | return 0; |
166 | } | 165 | } |
167 | 166 | ||
167 | static int fill_grant_buffer(struct blkfront_info *info, int num) | ||
168 | { | ||
169 | struct page *granted_page; | ||
170 | struct grant *gnt_list_entry, *n; | ||
171 | int i = 0; | ||
172 | |||
173 | while(i < num) { | ||
174 | gnt_list_entry = kzalloc(sizeof(struct grant), GFP_NOIO); | ||
175 | if (!gnt_list_entry) | ||
176 | goto out_of_memory; | ||
177 | |||
178 | granted_page = alloc_page(GFP_NOIO); | ||
179 | if (!granted_page) { | ||
180 | kfree(gnt_list_entry); | ||
181 | goto out_of_memory; | ||
182 | } | ||
183 | |||
184 | gnt_list_entry->pfn = page_to_pfn(granted_page); | ||
185 | gnt_list_entry->gref = GRANT_INVALID_REF; | ||
186 | list_add(&gnt_list_entry->node, &info->persistent_gnts); | ||
187 | i++; | ||
188 | } | ||
189 | |||
190 | return 0; | ||
191 | |||
192 | out_of_memory: | ||
193 | list_for_each_entry_safe(gnt_list_entry, n, | ||
194 | &info->persistent_gnts, node) { | ||
195 | list_del(&gnt_list_entry->node); | ||
196 | __free_page(pfn_to_page(gnt_list_entry->pfn)); | ||
197 | kfree(gnt_list_entry); | ||
198 | i--; | ||
199 | } | ||
200 | BUG_ON(i != 0); | ||
201 | return -ENOMEM; | ||
202 | } | ||
203 | |||
204 | static struct grant *get_grant(grant_ref_t *gref_head, | ||
205 | struct blkfront_info *info) | ||
206 | { | ||
207 | struct grant *gnt_list_entry; | ||
208 | unsigned long buffer_mfn; | ||
209 | |||
210 | BUG_ON(list_empty(&info->persistent_gnts)); | ||
211 | gnt_list_entry = list_first_entry(&info->persistent_gnts, struct grant, | ||
212 | node); | ||
213 | list_del(&gnt_list_entry->node); | ||
214 | |||
215 | if (gnt_list_entry->gref != GRANT_INVALID_REF) { | ||
216 | info->persistent_gnts_c--; | ||
217 | return gnt_list_entry; | ||
218 | } | ||
219 | |||
220 | /* Assign a gref to this page */ | ||
221 | gnt_list_entry->gref = gnttab_claim_grant_reference(gref_head); | ||
222 | BUG_ON(gnt_list_entry->gref == -ENOSPC); | ||
223 | buffer_mfn = pfn_to_mfn(gnt_list_entry->pfn); | ||
224 | gnttab_grant_foreign_access_ref(gnt_list_entry->gref, | ||
225 | info->xbdev->otherend_id, | ||
226 | buffer_mfn, 0); | ||
227 | return gnt_list_entry; | ||
228 | } | ||
229 | |||
168 | static const char *op_name(int op) | 230 | static const char *op_name(int op) |
169 | { | 231 | { |
170 | static const char *const names[] = { | 232 | static const char *const names[] = { |
@@ -293,7 +355,6 @@ static int blkif_ioctl(struct block_device *bdev, fmode_t mode, | |||
293 | static int blkif_queue_request(struct request *req) | 355 | static int blkif_queue_request(struct request *req) |
294 | { | 356 | { |
295 | struct blkfront_info *info = req->rq_disk->private_data; | 357 | struct blkfront_info *info = req->rq_disk->private_data; |
296 | unsigned long buffer_mfn; | ||
297 | struct blkif_request *ring_req; | 358 | struct blkif_request *ring_req; |
298 | unsigned long id; | 359 | unsigned long id; |
299 | unsigned int fsect, lsect; | 360 | unsigned int fsect, lsect; |
@@ -306,7 +367,6 @@ static int blkif_queue_request(struct request *req) | |||
306 | */ | 367 | */ |
307 | bool new_persistent_gnts; | 368 | bool new_persistent_gnts; |
308 | grant_ref_t gref_head; | 369 | grant_ref_t gref_head; |
309 | struct page *granted_page; | ||
310 | struct grant *gnt_list_entry = NULL; | 370 | struct grant *gnt_list_entry = NULL; |
311 | struct scatterlist *sg; | 371 | struct scatterlist *sg; |
312 | 372 | ||
@@ -370,41 +430,8 @@ static int blkif_queue_request(struct request *req) | |||
370 | fsect = sg->offset >> 9; | 430 | fsect = sg->offset >> 9; |
371 | lsect = fsect + (sg->length >> 9) - 1; | 431 | lsect = fsect + (sg->length >> 9) - 1; |
372 | 432 | ||
373 | if (info->persistent_gnts_c) { | 433 | gnt_list_entry = get_grant(&gref_head, info); |
374 | BUG_ON(llist_empty(&info->persistent_gnts)); | 434 | ref = gnt_list_entry->gref; |
375 | gnt_list_entry = llist_entry( | ||
376 | llist_del_first(&info->persistent_gnts), | ||
377 | struct grant, node); | ||
378 | |||
379 | ref = gnt_list_entry->gref; | ||
380 | buffer_mfn = pfn_to_mfn(gnt_list_entry->pfn); | ||
381 | info->persistent_gnts_c--; | ||
382 | } else { | ||
383 | ref = gnttab_claim_grant_reference(&gref_head); | ||
384 | BUG_ON(ref == -ENOSPC); | ||
385 | |||
386 | gnt_list_entry = | ||
387 | kmalloc(sizeof(struct grant), | ||
388 | GFP_ATOMIC); | ||
389 | if (!gnt_list_entry) | ||
390 | return -ENOMEM; | ||
391 | |||
392 | granted_page = alloc_page(GFP_ATOMIC); | ||
393 | if (!granted_page) { | ||
394 | kfree(gnt_list_entry); | ||
395 | return -ENOMEM; | ||
396 | } | ||
397 | |||
398 | gnt_list_entry->pfn = | ||
399 | page_to_pfn(granted_page); | ||
400 | gnt_list_entry->gref = ref; | ||
401 | |||
402 | buffer_mfn = pfn_to_mfn(page_to_pfn( | ||
403 | granted_page)); | ||
404 | gnttab_grant_foreign_access_ref(ref, | ||
405 | info->xbdev->otherend_id, | ||
406 | buffer_mfn, 0); | ||
407 | } | ||
408 | 435 | ||
409 | info->shadow[id].grants_used[i] = gnt_list_entry; | 436 | info->shadow[id].grants_used[i] = gnt_list_entry; |
410 | 437 | ||
@@ -435,7 +462,6 @@ static int blkif_queue_request(struct request *req) | |||
435 | kunmap_atomic(shared_data); | 462 | kunmap_atomic(shared_data); |
436 | } | 463 | } |
437 | 464 | ||
438 | info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn); | ||
439 | ring_req->u.rw.seg[i] = | 465 | ring_req->u.rw.seg[i] = |
440 | (struct blkif_request_segment) { | 466 | (struct blkif_request_segment) { |
441 | .gref = ref, | 467 | .gref = ref, |
@@ -790,9 +816,8 @@ static void blkif_restart_queue(struct work_struct *work) | |||
790 | 816 | ||
791 | static void blkif_free(struct blkfront_info *info, int suspend) | 817 | static void blkif_free(struct blkfront_info *info, int suspend) |
792 | { | 818 | { |
793 | struct llist_node *all_gnts; | 819 | struct grant *persistent_gnt; |
794 | struct grant *persistent_gnt, *tmp; | 820 | struct grant *n; |
795 | struct llist_node *n; | ||
796 | 821 | ||
797 | /* Prevent new requests being issued until we fix things up. */ | 822 | /* Prevent new requests being issued until we fix things up. */ |
798 | spin_lock_irq(&info->io_lock); | 823 | spin_lock_irq(&info->io_lock); |
@@ -803,22 +828,20 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
803 | blk_stop_queue(info->rq); | 828 | blk_stop_queue(info->rq); |
804 | 829 | ||
805 | /* Remove all persistent grants */ | 830 | /* Remove all persistent grants */ |
806 | if (info->persistent_gnts_c) { | 831 | if (!list_empty(&info->persistent_gnts)) { |
807 | all_gnts = llist_del_all(&info->persistent_gnts); | 832 | list_for_each_entry_safe(persistent_gnt, n, |
808 | persistent_gnt = llist_entry(all_gnts, typeof(*(persistent_gnt)), node); | 833 | &info->persistent_gnts, node) { |
809 | while (persistent_gnt) { | 834 | list_del(&persistent_gnt->node); |
810 | gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL); | 835 | if (persistent_gnt->gref != GRANT_INVALID_REF) { |
836 | gnttab_end_foreign_access(persistent_gnt->gref, | ||
837 | 0, 0UL); | ||
838 | info->persistent_gnts_c--; | ||
839 | } | ||
811 | __free_page(pfn_to_page(persistent_gnt->pfn)); | 840 | __free_page(pfn_to_page(persistent_gnt->pfn)); |
812 | tmp = persistent_gnt; | 841 | kfree(persistent_gnt); |
813 | n = persistent_gnt->node.next; | ||
814 | if (n) | ||
815 | persistent_gnt = llist_entry(n, typeof(*(persistent_gnt)), node); | ||
816 | else | ||
817 | persistent_gnt = NULL; | ||
818 | kfree(tmp); | ||
819 | } | 842 | } |
820 | info->persistent_gnts_c = 0; | ||
821 | } | 843 | } |
844 | BUG_ON(info->persistent_gnts_c != 0); | ||
822 | 845 | ||
823 | /* No more gnttab callback work. */ | 846 | /* No more gnttab callback work. */ |
824 | gnttab_cancel_free_callback(&info->callback); | 847 | gnttab_cancel_free_callback(&info->callback); |
@@ -875,7 +898,7 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | |||
875 | } | 898 | } |
876 | /* Add the persistent grant into the list of free grants */ | 899 | /* Add the persistent grant into the list of free grants */ |
877 | for (i = 0; i < s->req.u.rw.nr_segments; i++) { | 900 | for (i = 0; i < s->req.u.rw.nr_segments; i++) { |
878 | llist_add(&s->grants_used[i]->node, &info->persistent_gnts); | 901 | list_add(&s->grants_used[i]->node, &info->persistent_gnts); |
879 | info->persistent_gnts_c++; | 902 | info->persistent_gnts_c++; |
880 | } | 903 | } |
881 | } | 904 | } |
@@ -1013,6 +1036,12 @@ static int setup_blkring(struct xenbus_device *dev, | |||
1013 | 1036 | ||
1014 | sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); | 1037 | sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); |
1015 | 1038 | ||
1039 | /* Allocate memory for grants */ | ||
1040 | err = fill_grant_buffer(info, BLK_RING_SIZE * | ||
1041 | BLKIF_MAX_SEGMENTS_PER_REQUEST); | ||
1042 | if (err) | ||
1043 | goto fail; | ||
1044 | |||
1016 | err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); | 1045 | err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); |
1017 | if (err < 0) { | 1046 | if (err < 0) { |
1018 | free_page((unsigned long)sring); | 1047 | free_page((unsigned long)sring); |
@@ -1171,7 +1200,7 @@ static int blkfront_probe(struct xenbus_device *dev, | |||
1171 | spin_lock_init(&info->io_lock); | 1200 | spin_lock_init(&info->io_lock); |
1172 | info->xbdev = dev; | 1201 | info->xbdev = dev; |
1173 | info->vdevice = vdevice; | 1202 | info->vdevice = vdevice; |
1174 | init_llist_head(&info->persistent_gnts); | 1203 | INIT_LIST_HEAD(&info->persistent_gnts); |
1175 | info->persistent_gnts_c = 0; | 1204 | info->persistent_gnts_c = 0; |
1176 | info->connected = BLKIF_STATE_DISCONNECTED; | 1205 | info->connected = BLKIF_STATE_DISCONNECTED; |
1177 | INIT_WORK(&info->work, blkif_restart_queue); | 1206 | INIT_WORK(&info->work, blkif_restart_queue); |
@@ -1203,11 +1232,10 @@ static int blkif_recover(struct blkfront_info *info) | |||
1203 | int j; | 1232 | int j; |
1204 | 1233 | ||
1205 | /* Stage 1: Make a safe copy of the shadow state. */ | 1234 | /* Stage 1: Make a safe copy of the shadow state. */ |
1206 | copy = kmalloc(sizeof(info->shadow), | 1235 | copy = kmemdup(info->shadow, sizeof(info->shadow), |
1207 | GFP_NOIO | __GFP_REPEAT | __GFP_HIGH); | 1236 | GFP_NOIO | __GFP_REPEAT | __GFP_HIGH); |
1208 | if (!copy) | 1237 | if (!copy) |
1209 | return -ENOMEM; | 1238 | return -ENOMEM; |
1210 | memcpy(copy, info->shadow, sizeof(info->shadow)); | ||
1211 | 1239 | ||
1212 | /* Stage 2: Set up free list. */ | 1240 | /* Stage 2: Set up free list. */ |
1213 | memset(&info->shadow, 0, sizeof(info->shadow)); | 1241 | memset(&info->shadow, 0, sizeof(info->shadow)); |
@@ -1236,7 +1264,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
1236 | gnttab_grant_foreign_access_ref( | 1264 | gnttab_grant_foreign_access_ref( |
1237 | req->u.rw.seg[j].gref, | 1265 | req->u.rw.seg[j].gref, |
1238 | info->xbdev->otherend_id, | 1266 | info->xbdev->otherend_id, |
1239 | pfn_to_mfn(info->shadow[req->u.rw.id].frame[j]), | 1267 | pfn_to_mfn(copy[i].grants_used[j]->pfn), |
1240 | 0); | 1268 | 0); |
1241 | } | 1269 | } |
1242 | info->shadow[req->u.rw.id].req = *req; | 1270 | info->shadow[req->u.rw.id].req = *req; |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index a8a41e07a221..6aab00ef4379 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -73,9 +73,13 @@ static struct usb_device_id ath3k_table[] = { | |||
73 | { USB_DEVICE(0x03F0, 0x311D) }, | 73 | { USB_DEVICE(0x03F0, 0x311D) }, |
74 | 74 | ||
75 | /* Atheros AR3012 with sflash firmware*/ | 75 | /* Atheros AR3012 with sflash firmware*/ |
76 | { USB_DEVICE(0x0CF3, 0x0036) }, | ||
76 | { USB_DEVICE(0x0CF3, 0x3004) }, | 77 | { USB_DEVICE(0x0CF3, 0x3004) }, |
78 | { USB_DEVICE(0x0CF3, 0x3008) }, | ||
77 | { USB_DEVICE(0x0CF3, 0x311D) }, | 79 | { USB_DEVICE(0x0CF3, 0x311D) }, |
80 | { USB_DEVICE(0x0CF3, 0x817a) }, | ||
78 | { USB_DEVICE(0x13d3, 0x3375) }, | 81 | { USB_DEVICE(0x13d3, 0x3375) }, |
82 | { USB_DEVICE(0x04CA, 0x3004) }, | ||
79 | { USB_DEVICE(0x04CA, 0x3005) }, | 83 | { USB_DEVICE(0x04CA, 0x3005) }, |
80 | { USB_DEVICE(0x04CA, 0x3006) }, | 84 | { USB_DEVICE(0x04CA, 0x3006) }, |
81 | { USB_DEVICE(0x04CA, 0x3008) }, | 85 | { USB_DEVICE(0x04CA, 0x3008) }, |
@@ -105,9 +109,13 @@ MODULE_DEVICE_TABLE(usb, ath3k_table); | |||
105 | static struct usb_device_id ath3k_blist_tbl[] = { | 109 | static struct usb_device_id ath3k_blist_tbl[] = { |
106 | 110 | ||
107 | /* Atheros AR3012 with sflash firmware*/ | 111 | /* Atheros AR3012 with sflash firmware*/ |
112 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, | ||
108 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 113 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
114 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | ||
109 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 115 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
116 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, | ||
110 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 117 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
118 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | ||
111 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 119 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
112 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | 120 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
113 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 121 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 7e351e345476..2cc5f774a29c 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -131,9 +131,13 @@ static struct usb_device_id blacklist_table[] = { | |||
131 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | 131 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
132 | 132 | ||
133 | /* Atheros 3012 with sflash firmware */ | 133 | /* Atheros 3012 with sflash firmware */ |
134 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, | ||
134 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 135 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
136 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | ||
135 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
138 | { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 }, | ||
136 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
140 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | ||
137 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
138 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
139 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 143 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index e3f9a99b8522..d784650d14f0 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -373,26 +373,14 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma) | |||
373 | struct hpet_dev *devp; | 373 | struct hpet_dev *devp; |
374 | unsigned long addr; | 374 | unsigned long addr; |
375 | 375 | ||
376 | if (((vma->vm_end - vma->vm_start) != PAGE_SIZE) || vma->vm_pgoff) | ||
377 | return -EINVAL; | ||
378 | |||
379 | devp = file->private_data; | 376 | devp = file->private_data; |
380 | addr = devp->hd_hpets->hp_hpet_phys; | 377 | addr = devp->hd_hpets->hp_hpet_phys; |
381 | 378 | ||
382 | if (addr & (PAGE_SIZE - 1)) | 379 | if (addr & (PAGE_SIZE - 1)) |
383 | return -ENOSYS; | 380 | return -ENOSYS; |
384 | 381 | ||
385 | vma->vm_flags |= VM_IO; | ||
386 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 382 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
387 | 383 | return vm_iomap_memory(vma, addr, PAGE_SIZE); | |
388 | if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, | ||
389 | PAGE_SIZE, vma->vm_page_prot)) { | ||
390 | printk(KERN_ERR "%s: io_remap_pfn_range failed\n", | ||
391 | __func__); | ||
392 | return -EAGAIN; | ||
393 | } | ||
394 | |||
395 | return 0; | ||
396 | #else | 384 | #else |
397 | return -ENOSYS; | 385 | return -ENOSYS; |
398 | #endif | 386 | #endif |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 69ae5972713c..a0f7724852eb 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -380,6 +380,15 @@ void hwrng_unregister(struct hwrng *rng) | |||
380 | } | 380 | } |
381 | EXPORT_SYMBOL_GPL(hwrng_unregister); | 381 | EXPORT_SYMBOL_GPL(hwrng_unregister); |
382 | 382 | ||
383 | static void __exit hwrng_exit(void) | ||
384 | { | ||
385 | mutex_lock(&rng_mutex); | ||
386 | BUG_ON(current_rng); | ||
387 | kfree(rng_buffer); | ||
388 | mutex_unlock(&rng_mutex); | ||
389 | } | ||
390 | |||
391 | module_exit(hwrng_exit); | ||
383 | 392 | ||
384 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); | 393 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); |
385 | MODULE_LICENSE("GPL"); | 394 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 10fd71ccf587..6bf4d47324eb 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -92,14 +92,22 @@ static int probe_common(struct virtio_device *vdev) | |||
92 | { | 92 | { |
93 | int err; | 93 | int err; |
94 | 94 | ||
95 | if (vq) { | ||
96 | /* We only support one device for now */ | ||
97 | return -EBUSY; | ||
98 | } | ||
95 | /* We expect a single virtqueue. */ | 99 | /* We expect a single virtqueue. */ |
96 | vq = virtio_find_single_vq(vdev, random_recv_done, "input"); | 100 | vq = virtio_find_single_vq(vdev, random_recv_done, "input"); |
97 | if (IS_ERR(vq)) | 101 | if (IS_ERR(vq)) { |
98 | return PTR_ERR(vq); | 102 | err = PTR_ERR(vq); |
103 | vq = NULL; | ||
104 | return err; | ||
105 | } | ||
99 | 106 | ||
100 | err = hwrng_register(&virtio_hwrng); | 107 | err = hwrng_register(&virtio_hwrng); |
101 | if (err) { | 108 | if (err) { |
102 | vdev->config->del_vqs(vdev); | 109 | vdev->config->del_vqs(vdev); |
110 | vq = NULL; | ||
103 | return err; | 111 | return err; |
104 | } | 112 | } |
105 | 113 | ||
@@ -112,6 +120,7 @@ static void remove_common(struct virtio_device *vdev) | |||
112 | busy = false; | 120 | busy = false; |
113 | hwrng_unregister(&virtio_hwrng); | 121 | hwrng_unregister(&virtio_hwrng); |
114 | vdev->config->del_vqs(vdev); | 122 | vdev->config->del_vqs(vdev); |
123 | vq = NULL; | ||
115 | } | 124 | } |
116 | 125 | ||
117 | static int virtrng_probe(struct virtio_device *vdev) | 126 | static int virtrng_probe(struct virtio_device *vdev) |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e905d5f53051..ce5f3fc25d6d 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -149,7 +149,8 @@ struct ports_device { | |||
149 | spinlock_t ports_lock; | 149 | spinlock_t ports_lock; |
150 | 150 | ||
151 | /* To protect the vq operations for the control channel */ | 151 | /* To protect the vq operations for the control channel */ |
152 | spinlock_t cvq_lock; | 152 | spinlock_t c_ivq_lock; |
153 | spinlock_t c_ovq_lock; | ||
153 | 154 | ||
154 | /* The current config space is stored here */ | 155 | /* The current config space is stored here */ |
155 | struct virtio_console_config config; | 156 | struct virtio_console_config config; |
@@ -569,11 +570,14 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, | |||
569 | vq = portdev->c_ovq; | 570 | vq = portdev->c_ovq; |
570 | 571 | ||
571 | sg_init_one(sg, &cpkt, sizeof(cpkt)); | 572 | sg_init_one(sg, &cpkt, sizeof(cpkt)); |
573 | |||
574 | spin_lock(&portdev->c_ovq_lock); | ||
572 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { | 575 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { |
573 | virtqueue_kick(vq); | 576 | virtqueue_kick(vq); |
574 | while (!virtqueue_get_buf(vq, &len)) | 577 | while (!virtqueue_get_buf(vq, &len)) |
575 | cpu_relax(); | 578 | cpu_relax(); |
576 | } | 579 | } |
580 | spin_unlock(&portdev->c_ovq_lock); | ||
577 | return 0; | 581 | return 0; |
578 | } | 582 | } |
579 | 583 | ||
@@ -1436,7 +1440,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1436 | * rproc_serial does not want the console port, only | 1440 | * rproc_serial does not want the console port, only |
1437 | * the generic port implementation. | 1441 | * the generic port implementation. |
1438 | */ | 1442 | */ |
1439 | port->host_connected = port->guest_connected = true; | 1443 | port->host_connected = true; |
1440 | else if (!use_multiport(port->portdev)) { | 1444 | else if (!use_multiport(port->portdev)) { |
1441 | /* | 1445 | /* |
1442 | * If we're not using multiport support, | 1446 | * If we're not using multiport support, |
@@ -1709,23 +1713,23 @@ static void control_work_handler(struct work_struct *work) | |||
1709 | portdev = container_of(work, struct ports_device, control_work); | 1713 | portdev = container_of(work, struct ports_device, control_work); |
1710 | vq = portdev->c_ivq; | 1714 | vq = portdev->c_ivq; |
1711 | 1715 | ||
1712 | spin_lock(&portdev->cvq_lock); | 1716 | spin_lock(&portdev->c_ivq_lock); |
1713 | while ((buf = virtqueue_get_buf(vq, &len))) { | 1717 | while ((buf = virtqueue_get_buf(vq, &len))) { |
1714 | spin_unlock(&portdev->cvq_lock); | 1718 | spin_unlock(&portdev->c_ivq_lock); |
1715 | 1719 | ||
1716 | buf->len = len; | 1720 | buf->len = len; |
1717 | buf->offset = 0; | 1721 | buf->offset = 0; |
1718 | 1722 | ||
1719 | handle_control_message(portdev, buf); | 1723 | handle_control_message(portdev, buf); |
1720 | 1724 | ||
1721 | spin_lock(&portdev->cvq_lock); | 1725 | spin_lock(&portdev->c_ivq_lock); |
1722 | if (add_inbuf(portdev->c_ivq, buf) < 0) { | 1726 | if (add_inbuf(portdev->c_ivq, buf) < 0) { |
1723 | dev_warn(&portdev->vdev->dev, | 1727 | dev_warn(&portdev->vdev->dev, |
1724 | "Error adding buffer to queue\n"); | 1728 | "Error adding buffer to queue\n"); |
1725 | free_buf(buf, false); | 1729 | free_buf(buf, false); |
1726 | } | 1730 | } |
1727 | } | 1731 | } |
1728 | spin_unlock(&portdev->cvq_lock); | 1732 | spin_unlock(&portdev->c_ivq_lock); |
1729 | } | 1733 | } |
1730 | 1734 | ||
1731 | static void out_intr(struct virtqueue *vq) | 1735 | static void out_intr(struct virtqueue *vq) |
@@ -1752,13 +1756,23 @@ static void in_intr(struct virtqueue *vq) | |||
1752 | port->inbuf = get_inbuf(port); | 1756 | port->inbuf = get_inbuf(port); |
1753 | 1757 | ||
1754 | /* | 1758 | /* |
1755 | * Don't queue up data when port is closed. This condition | 1759 | * Normally the port should not accept data when the port is |
1760 | * closed. For generic serial ports, the host won't (shouldn't) | ||
1761 | * send data till the guest is connected. But this condition | ||
1756 | * can be reached when a console port is not yet connected (no | 1762 | * can be reached when a console port is not yet connected (no |
1757 | * tty is spawned) and the host sends out data to console | 1763 | * tty is spawned) and the other side sends out data over the |
1758 | * ports. For generic serial ports, the host won't | 1764 | * vring, or when a remote devices start sending data before |
1759 | * (shouldn't) send data till the guest is connected. | 1765 | * the ports are opened. |
1766 | * | ||
1767 | * A generic serial port will discard data if not connected, | ||
1768 | * while console ports and rproc-serial ports accepts data at | ||
1769 | * any time. rproc-serial is initiated with guest_connected to | ||
1770 | * false because port_fops_open expects this. Console ports are | ||
1771 | * hooked up with an HVC console and is initialized with | ||
1772 | * guest_connected to true. | ||
1760 | */ | 1773 | */ |
1761 | if (!port->guest_connected) | 1774 | |
1775 | if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev)) | ||
1762 | discard_port_data(port); | 1776 | discard_port_data(port); |
1763 | 1777 | ||
1764 | spin_unlock_irqrestore(&port->inbuf_lock, flags); | 1778 | spin_unlock_irqrestore(&port->inbuf_lock, flags); |
@@ -1986,10 +2000,12 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
1986 | if (multiport) { | 2000 | if (multiport) { |
1987 | unsigned int nr_added_bufs; | 2001 | unsigned int nr_added_bufs; |
1988 | 2002 | ||
1989 | spin_lock_init(&portdev->cvq_lock); | 2003 | spin_lock_init(&portdev->c_ivq_lock); |
2004 | spin_lock_init(&portdev->c_ovq_lock); | ||
1990 | INIT_WORK(&portdev->control_work, &control_work_handler); | 2005 | INIT_WORK(&portdev->control_work, &control_work_handler); |
1991 | 2006 | ||
1992 | nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock); | 2007 | nr_added_bufs = fill_queue(portdev->c_ivq, |
2008 | &portdev->c_ivq_lock); | ||
1993 | if (!nr_added_bufs) { | 2009 | if (!nr_added_bufs) { |
1994 | dev_err(&vdev->dev, | 2010 | dev_err(&vdev->dev, |
1995 | "Error allocating buffers for control queue\n"); | 2011 | "Error allocating buffers for control queue\n"); |
@@ -2140,7 +2156,7 @@ static int virtcons_restore(struct virtio_device *vdev) | |||
2140 | return ret; | 2156 | return ret; |
2141 | 2157 | ||
2142 | if (use_multiport(portdev)) | 2158 | if (use_multiport(portdev)) |
2143 | fill_queue(portdev->c_ivq, &portdev->cvq_lock); | 2159 | fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); |
2144 | 2160 | ||
2145 | list_for_each_entry(port, &portdev->ports, list) { | 2161 | list_for_each_entry(port, &portdev->ports, list) { |
2146 | port->in_vq = portdev->in_vqs[port->id]; | 2162 | port->in_vq = portdev->in_vqs[port->id]; |
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index b5538bba7a10..09c63315e579 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c | |||
@@ -157,7 +157,7 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, | |||
157 | divisor = parent_rate / rate; | 157 | divisor = parent_rate / rate; |
158 | 158 | ||
159 | /* If prate / rate would be decimal, incr the divisor */ | 159 | /* If prate / rate would be decimal, incr the divisor */ |
160 | if (rate * divisor < *prate) | 160 | if (rate * divisor < parent_rate) |
161 | divisor++; | 161 | divisor++; |
162 | 162 | ||
163 | if (divisor == cdev->div_mask + 1) | 163 | if (divisor == cdev->div_mask + 1) |
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index 143ce1f899ad..f873dcefe0de 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -703,7 +703,7 @@ static void tegra20_pll_init(void) | |||
703 | clks[pll_a_out0] = clk; | 703 | clks[pll_a_out0] = clk; |
704 | 704 | ||
705 | /* PLLE */ | 705 | /* PLLE */ |
706 | clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, NULL, | 706 | clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base, |
707 | 0, 100000000, &pll_e_params, | 707 | 0, 100000000, &pll_e_params, |
708 | 0, pll_e_freq_table, NULL); | 708 | 0, pll_e_freq_table, NULL); |
709 | clk_register_clkdev(clk, "pll_e", NULL); | 709 | clk_register_clkdev(clk, "pll_e", NULL); |
@@ -1292,7 +1292,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = { | |||
1292 | TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), | 1292 | TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), |
1293 | TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), | 1293 | TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), |
1294 | TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"), | 1294 | TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"), |
1295 | TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL), | ||
1296 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */ | 1295 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */ |
1297 | }; | 1296 | }; |
1298 | 1297 | ||
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index 32c61cb6d0bb..ba6f51bc9f3b 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -1931,7 +1931,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = { | |||
1931 | TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL), | 1931 | TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL), |
1932 | TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"), | 1932 | TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"), |
1933 | TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"), | 1933 | TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"), |
1934 | TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL), | ||
1935 | TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"), | 1934 | TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"), |
1936 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */ | 1935 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */ |
1937 | }; | 1936 | }; |
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 937bc286591f..57a8774f0b4e 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
@@ -730,7 +730,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
730 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { | 730 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { |
731 | cpumask_copy(policy->cpus, perf->shared_cpu_map); | 731 | cpumask_copy(policy->cpus, perf->shared_cpu_map); |
732 | } | 732 | } |
733 | cpumask_copy(policy->related_cpus, perf->shared_cpu_map); | ||
734 | 733 | ||
735 | #ifdef CONFIG_SMP | 734 | #ifdef CONFIG_SMP |
736 | dmi_check_system(sw_any_bug_dmi_table); | 735 | dmi_check_system(sw_any_bug_dmi_table); |
@@ -742,7 +741,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
742 | if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) { | 741 | if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) { |
743 | cpumask_clear(policy->cpus); | 742 | cpumask_clear(policy->cpus); |
744 | cpumask_set_cpu(cpu, policy->cpus); | 743 | cpumask_set_cpu(cpu, policy->cpus); |
745 | cpumask_copy(policy->related_cpus, cpu_sibling_mask(cpu)); | ||
746 | policy->shared_type = CPUFREQ_SHARED_TYPE_HW; | 744 | policy->shared_type = CPUFREQ_SHARED_TYPE_HW; |
747 | pr_info_once(PFX "overriding BIOS provided _PSD data\n"); | 745 | pr_info_once(PFX "overriding BIOS provided _PSD data\n"); |
748 | } | 746 | } |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 4e5b7fb8927c..37d23a0f8c56 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -178,10 +178,16 @@ static struct cpufreq_driver cpu0_cpufreq_driver = { | |||
178 | 178 | ||
179 | static int cpu0_cpufreq_probe(struct platform_device *pdev) | 179 | static int cpu0_cpufreq_probe(struct platform_device *pdev) |
180 | { | 180 | { |
181 | struct device_node *np; | 181 | struct device_node *np, *parent; |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | for_each_child_of_node(of_find_node_by_path("/cpus"), np) { | 184 | parent = of_find_node_by_path("/cpus"); |
185 | if (!parent) { | ||
186 | pr_err("failed to find OF /cpus\n"); | ||
187 | return -ENOENT; | ||
188 | } | ||
189 | |||
190 | for_each_child_of_node(parent, np) { | ||
185 | if (of_get_property(np, "operating-points", NULL)) | 191 | if (of_get_property(np, "operating-points", NULL)) |
186 | break; | 192 | break; |
187 | } | 193 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 46bde01eee62..cc4bd2f6838a 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -14,8 +14,8 @@ | |||
14 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef _CPUFREQ_GOVERNER_H | 17 | #ifndef _CPUFREQ_GOVERNOR_H |
18 | #define _CPUFREQ_GOVERNER_H | 18 | #define _CPUFREQ_GOVERNOR_H |
19 | 19 | ||
20 | #include <linux/cpufreq.h> | 20 | #include <linux/cpufreq.h> |
21 | #include <linux/kobject.h> | 21 | #include <linux/kobject.h> |
@@ -175,4 +175,4 @@ bool need_load_eval(struct cpu_dbs_common_info *cdbs, | |||
175 | unsigned int sampling_rate); | 175 | unsigned int sampling_rate); |
176 | int cpufreq_governor_dbs(struct dbs_data *dbs_data, | 176 | int cpufreq_governor_dbs(struct dbs_data *dbs_data, |
177 | struct cpufreq_policy *policy, unsigned int event); | 177 | struct cpufreq_policy *policy, unsigned int event); |
178 | #endif /* _CPUFREQ_GOVERNER_H */ | 178 | #endif /* _CPUFREQ_GOVERNOR_H */ |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 2fd779eb1ed1..bfd6273fd873 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -180,15 +180,19 @@ static void cpufreq_stats_free_sysfs(unsigned int cpu) | |||
180 | { | 180 | { |
181 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 181 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
182 | 182 | ||
183 | if (!cpufreq_frequency_get_table(cpu)) | 183 | if (!policy) |
184 | return; | 184 | return; |
185 | 185 | ||
186 | if (policy && !policy_is_shared(policy)) { | 186 | if (!cpufreq_frequency_get_table(cpu)) |
187 | goto put_ref; | ||
188 | |||
189 | if (!policy_is_shared(policy)) { | ||
187 | pr_debug("%s: Free sysfs stat\n", __func__); | 190 | pr_debug("%s: Free sysfs stat\n", __func__); |
188 | sysfs_remove_group(&policy->kobj, &stats_attr_group); | 191 | sysfs_remove_group(&policy->kobj, &stats_attr_group); |
189 | } | 192 | } |
190 | if (policy) | 193 | |
191 | cpufreq_cpu_put(policy); | 194 | put_ref: |
195 | cpufreq_cpu_put(policy); | ||
192 | } | 196 | } |
193 | 197 | ||
194 | static int cpufreq_stats_create_table(struct cpufreq_policy *policy, | 198 | static int cpufreq_stats_create_table(struct cpufreq_policy *policy, |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f6dd1e761129..6133ef5cf671 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -358,14 +358,14 @@ static void intel_pstate_sysfs_expose_params(void) | |||
358 | static int intel_pstate_min_pstate(void) | 358 | static int intel_pstate_min_pstate(void) |
359 | { | 359 | { |
360 | u64 value; | 360 | u64 value; |
361 | rdmsrl(0xCE, value); | 361 | rdmsrl(MSR_PLATFORM_INFO, value); |
362 | return (value >> 40) & 0xFF; | 362 | return (value >> 40) & 0xFF; |
363 | } | 363 | } |
364 | 364 | ||
365 | static int intel_pstate_max_pstate(void) | 365 | static int intel_pstate_max_pstate(void) |
366 | { | 366 | { |
367 | u64 value; | 367 | u64 value; |
368 | rdmsrl(0xCE, value); | 368 | rdmsrl(MSR_PLATFORM_INFO, value); |
369 | return (value >> 8) & 0xFF; | 369 | return (value >> 8) & 0xFF; |
370 | } | 370 | } |
371 | 371 | ||
@@ -373,7 +373,7 @@ static int intel_pstate_turbo_pstate(void) | |||
373 | { | 373 | { |
374 | u64 value; | 374 | u64 value; |
375 | int nont, ret; | 375 | int nont, ret; |
376 | rdmsrl(0x1AD, value); | 376 | rdmsrl(MSR_NHM_TURBO_RATIO_LIMIT, value); |
377 | nont = intel_pstate_max_pstate(); | 377 | nont = intel_pstate_max_pstate(); |
378 | ret = ((value) & 255); | 378 | ret = ((value) & 255); |
379 | if (ret <= nont) | 379 | if (ret <= nont) |
@@ -454,7 +454,7 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu, | |||
454 | sample->idletime_us * 100, | 454 | sample->idletime_us * 100, |
455 | sample->duration_us); | 455 | sample->duration_us); |
456 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); | 456 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); |
457 | sample->freq = cpu->pstate.turbo_pstate * core_pct * 1000; | 457 | sample->freq = cpu->pstate.max_pstate * core_pct * 1000; |
458 | 458 | ||
459 | sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct), | 459 | sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct), |
460 | 100); | 460 | 100); |
@@ -502,7 +502,6 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) | |||
502 | 502 | ||
503 | sample_time = cpu->pstate_policy->sample_rate_ms; | 503 | sample_time = cpu->pstate_policy->sample_rate_ms; |
504 | delay = msecs_to_jiffies(sample_time); | 504 | delay = msecs_to_jiffies(sample_time); |
505 | delay -= jiffies % delay; | ||
506 | mod_timer_pinned(&cpu->timer, jiffies + delay); | 505 | mod_timer_pinned(&cpu->timer, jiffies + delay); |
507 | } | 506 | } |
508 | 507 | ||
@@ -752,6 +751,29 @@ static struct cpufreq_driver intel_pstate_driver = { | |||
752 | 751 | ||
753 | static int __initdata no_load; | 752 | static int __initdata no_load; |
754 | 753 | ||
754 | static int intel_pstate_msrs_not_valid(void) | ||
755 | { | ||
756 | /* Check that all the msr's we are using are valid. */ | ||
757 | u64 aperf, mperf, tmp; | ||
758 | |||
759 | rdmsrl(MSR_IA32_APERF, aperf); | ||
760 | rdmsrl(MSR_IA32_MPERF, mperf); | ||
761 | |||
762 | if (!intel_pstate_min_pstate() || | ||
763 | !intel_pstate_max_pstate() || | ||
764 | !intel_pstate_turbo_pstate()) | ||
765 | return -ENODEV; | ||
766 | |||
767 | rdmsrl(MSR_IA32_APERF, tmp); | ||
768 | if (!(tmp - aperf)) | ||
769 | return -ENODEV; | ||
770 | |||
771 | rdmsrl(MSR_IA32_MPERF, tmp); | ||
772 | if (!(tmp - mperf)) | ||
773 | return -ENODEV; | ||
774 | |||
775 | return 0; | ||
776 | } | ||
755 | static int __init intel_pstate_init(void) | 777 | static int __init intel_pstate_init(void) |
756 | { | 778 | { |
757 | int cpu, rc = 0; | 779 | int cpu, rc = 0; |
@@ -764,6 +786,9 @@ static int __init intel_pstate_init(void) | |||
764 | if (!id) | 786 | if (!id) |
765 | return -ENODEV; | 787 | return -ENODEV; |
766 | 788 | ||
789 | if (intel_pstate_msrs_not_valid()) | ||
790 | return -ENODEV; | ||
791 | |||
767 | pr_info("Intel P-state driver initializing.\n"); | 792 | pr_info("Intel P-state driver initializing.\n"); |
768 | 793 | ||
769 | all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus()); | 794 | all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus()); |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index b2a0a0726a54..cf268b14ae9a 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -1650,11 +1650,7 @@ struct caam_alg_template { | |||
1650 | }; | 1650 | }; |
1651 | 1651 | ||
1652 | static struct caam_alg_template driver_algs[] = { | 1652 | static struct caam_alg_template driver_algs[] = { |
1653 | /* | 1653 | /* single-pass ipsec_esp descriptor */ |
1654 | * single-pass ipsec_esp descriptor | ||
1655 | * authencesn(*,*) is also registered, although not present | ||
1656 | * explicitly here. | ||
1657 | */ | ||
1658 | { | 1654 | { |
1659 | .name = "authenc(hmac(md5),cbc(aes))", | 1655 | .name = "authenc(hmac(md5),cbc(aes))", |
1660 | .driver_name = "authenc-hmac-md5-cbc-aes-caam", | 1656 | .driver_name = "authenc-hmac-md5-cbc-aes-caam", |
@@ -2217,9 +2213,7 @@ static int __init caam_algapi_init(void) | |||
2217 | for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { | 2213 | for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { |
2218 | /* TODO: check if h/w supports alg */ | 2214 | /* TODO: check if h/w supports alg */ |
2219 | struct caam_crypto_alg *t_alg; | 2215 | struct caam_crypto_alg *t_alg; |
2220 | bool done = false; | ||
2221 | 2216 | ||
2222 | authencesn: | ||
2223 | t_alg = caam_alg_alloc(ctrldev, &driver_algs[i]); | 2217 | t_alg = caam_alg_alloc(ctrldev, &driver_algs[i]); |
2224 | if (IS_ERR(t_alg)) { | 2218 | if (IS_ERR(t_alg)) { |
2225 | err = PTR_ERR(t_alg); | 2219 | err = PTR_ERR(t_alg); |
@@ -2233,25 +2227,8 @@ authencesn: | |||
2233 | dev_warn(ctrldev, "%s alg registration failed\n", | 2227 | dev_warn(ctrldev, "%s alg registration failed\n", |
2234 | t_alg->crypto_alg.cra_driver_name); | 2228 | t_alg->crypto_alg.cra_driver_name); |
2235 | kfree(t_alg); | 2229 | kfree(t_alg); |
2236 | } else { | 2230 | } else |
2237 | list_add_tail(&t_alg->entry, &priv->alg_list); | 2231 | list_add_tail(&t_alg->entry, &priv->alg_list); |
2238 | if (driver_algs[i].type == CRYPTO_ALG_TYPE_AEAD && | ||
2239 | !memcmp(driver_algs[i].name, "authenc", 7) && | ||
2240 | !done) { | ||
2241 | char *name; | ||
2242 | |||
2243 | name = driver_algs[i].name; | ||
2244 | memmove(name + 10, name + 7, strlen(name) - 7); | ||
2245 | memcpy(name + 7, "esn", 3); | ||
2246 | |||
2247 | name = driver_algs[i].driver_name; | ||
2248 | memmove(name + 10, name + 7, strlen(name) - 7); | ||
2249 | memcpy(name + 7, "esn", 3); | ||
2250 | |||
2251 | done = true; | ||
2252 | goto authencesn; | ||
2253 | } | ||
2254 | } | ||
2255 | } | 2232 | } |
2256 | if (!list_empty(&priv->alg_list)) | 2233 | if (!list_empty(&priv->alg_list)) |
2257 | dev_info(ctrldev, "%s algorithms registered in /proc/crypto\n", | 2234 | dev_info(ctrldev, "%s algorithms registered in /proc/crypto\n", |
diff --git a/drivers/crypto/caam/compat.h b/drivers/crypto/caam/compat.h index cf15e7813801..762aeff626ac 100644 --- a/drivers/crypto/caam/compat.h +++ b/drivers/crypto/caam/compat.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/debugfs.h> | 24 | #include <linux/debugfs.h> |
25 | #include <linux/circ_buf.h> | 25 | #include <linux/circ_buf.h> |
26 | #include <linux/string.h> | ||
27 | #include <net/xfrm.h> | 26 | #include <net/xfrm.h> |
28 | 27 | ||
29 | #include <crypto/algapi.h> | 28 | #include <crypto/algapi.h> |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 09b184adf31b..5b2b5e61e4f9 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
39 | #include <linux/rtnetlink.h> | 39 | #include <linux/rtnetlink.h> |
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/string.h> | ||
42 | 41 | ||
43 | #include <crypto/algapi.h> | 42 | #include <crypto/algapi.h> |
44 | #include <crypto/aes.h> | 43 | #include <crypto/aes.h> |
@@ -1974,11 +1973,7 @@ struct talitos_alg_template { | |||
1974 | }; | 1973 | }; |
1975 | 1974 | ||
1976 | static struct talitos_alg_template driver_algs[] = { | 1975 | static struct talitos_alg_template driver_algs[] = { |
1977 | /* | 1976 | /* AEAD algorithms. These use a single-pass ipsec_esp descriptor */ |
1978 | * AEAD algorithms. These use a single-pass ipsec_esp descriptor. | ||
1979 | * authencesn(*,*) is also registered, although not present | ||
1980 | * explicitly here. | ||
1981 | */ | ||
1982 | { .type = CRYPTO_ALG_TYPE_AEAD, | 1977 | { .type = CRYPTO_ALG_TYPE_AEAD, |
1983 | .alg.crypto = { | 1978 | .alg.crypto = { |
1984 | .cra_name = "authenc(hmac(sha1),cbc(aes))", | 1979 | .cra_name = "authenc(hmac(sha1),cbc(aes))", |
@@ -2820,9 +2815,7 @@ static int talitos_probe(struct platform_device *ofdev) | |||
2820 | if (hw_supports(dev, driver_algs[i].desc_hdr_template)) { | 2815 | if (hw_supports(dev, driver_algs[i].desc_hdr_template)) { |
2821 | struct talitos_crypto_alg *t_alg; | 2816 | struct talitos_crypto_alg *t_alg; |
2822 | char *name = NULL; | 2817 | char *name = NULL; |
2823 | bool authenc = false; | ||
2824 | 2818 | ||
2825 | authencesn: | ||
2826 | t_alg = talitos_alg_alloc(dev, &driver_algs[i]); | 2819 | t_alg = talitos_alg_alloc(dev, &driver_algs[i]); |
2827 | if (IS_ERR(t_alg)) { | 2820 | if (IS_ERR(t_alg)) { |
2828 | err = PTR_ERR(t_alg); | 2821 | err = PTR_ERR(t_alg); |
@@ -2837,8 +2830,6 @@ authencesn: | |||
2837 | err = crypto_register_alg( | 2830 | err = crypto_register_alg( |
2838 | &t_alg->algt.alg.crypto); | 2831 | &t_alg->algt.alg.crypto); |
2839 | name = t_alg->algt.alg.crypto.cra_driver_name; | 2832 | name = t_alg->algt.alg.crypto.cra_driver_name; |
2840 | authenc = authenc ? !authenc : | ||
2841 | !(bool)memcmp(name, "authenc", 7); | ||
2842 | break; | 2833 | break; |
2843 | case CRYPTO_ALG_TYPE_AHASH: | 2834 | case CRYPTO_ALG_TYPE_AHASH: |
2844 | err = crypto_register_ahash( | 2835 | err = crypto_register_ahash( |
@@ -2851,25 +2842,8 @@ authencesn: | |||
2851 | dev_err(dev, "%s alg registration failed\n", | 2842 | dev_err(dev, "%s alg registration failed\n", |
2852 | name); | 2843 | name); |
2853 | kfree(t_alg); | 2844 | kfree(t_alg); |
2854 | } else { | 2845 | } else |
2855 | list_add_tail(&t_alg->entry, &priv->alg_list); | 2846 | list_add_tail(&t_alg->entry, &priv->alg_list); |
2856 | if (authenc) { | ||
2857 | struct crypto_alg *alg = | ||
2858 | &driver_algs[i].alg.crypto; | ||
2859 | |||
2860 | name = alg->cra_name; | ||
2861 | memmove(name + 10, name + 7, | ||
2862 | strlen(name) - 7); | ||
2863 | memcpy(name + 7, "esn", 3); | ||
2864 | |||
2865 | name = alg->cra_driver_name; | ||
2866 | memmove(name + 10, name + 7, | ||
2867 | strlen(name) - 7); | ||
2868 | memcpy(name + 7, "esn", 3); | ||
2869 | |||
2870 | goto authencesn; | ||
2871 | } | ||
2872 | } | ||
2873 | } | 2847 | } |
2874 | } | 2848 | } |
2875 | if (!list_empty(&priv->alg_list)) | 2849 | if (!list_empty(&priv->alg_list)) |
diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 8bc5fef07e7a..22c9063e0120 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c | |||
@@ -1750,7 +1750,7 @@ static struct platform_driver cryp_driver = { | |||
1750 | .shutdown = ux500_cryp_shutdown, | 1750 | .shutdown = ux500_cryp_shutdown, |
1751 | .driver = { | 1751 | .driver = { |
1752 | .owner = THIS_MODULE, | 1752 | .owner = THIS_MODULE, |
1753 | .name = "cryp1" | 1753 | .name = "cryp1", |
1754 | .pm = &ux500_cryp_pm, | 1754 | .pm = &ux500_cryp_pm, |
1755 | } | 1755 | } |
1756 | }; | 1756 | }; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 80b69971cf28..aeaea32bcfda 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -83,6 +83,7 @@ config INTEL_IOP_ADMA | |||
83 | 83 | ||
84 | config DW_DMAC | 84 | config DW_DMAC |
85 | tristate "Synopsys DesignWare AHB DMA support" | 85 | tristate "Synopsys DesignWare AHB DMA support" |
86 | depends on GENERIC_HARDIRQS | ||
86 | select DMA_ENGINE | 87 | select DMA_ENGINE |
87 | default y if CPU_AT32AP7000 | 88 | default y if CPU_AT32AP7000 |
88 | help | 89 | help |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 6e13f262139a..88cfc61329d2 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -310,8 +310,6 @@ static void atc_complete_all(struct at_dma_chan *atchan) | |||
310 | 310 | ||
311 | dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n"); | 311 | dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n"); |
312 | 312 | ||
313 | BUG_ON(atc_chan_is_enabled(atchan)); | ||
314 | |||
315 | /* | 313 | /* |
316 | * Submit queued descriptors ASAP, i.e. before we go through | 314 | * Submit queued descriptors ASAP, i.e. before we go through |
317 | * the completed ones. | 315 | * the completed ones. |
@@ -368,6 +366,9 @@ static void atc_advance_work(struct at_dma_chan *atchan) | |||
368 | { | 366 | { |
369 | dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n"); | 367 | dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n"); |
370 | 368 | ||
369 | if (atc_chan_is_enabled(atchan)) | ||
370 | return; | ||
371 | |||
371 | if (list_empty(&atchan->active_list) || | 372 | if (list_empty(&atchan->active_list) || |
372 | list_is_singular(&atchan->active_list)) { | 373 | list_is_singular(&atchan->active_list)) { |
373 | atc_complete_all(atchan); | 374 | atc_complete_all(atchan); |
@@ -1078,9 +1079,7 @@ static void atc_issue_pending(struct dma_chan *chan) | |||
1078 | return; | 1079 | return; |
1079 | 1080 | ||
1080 | spin_lock_irqsave(&atchan->lock, flags); | 1081 | spin_lock_irqsave(&atchan->lock, flags); |
1081 | if (!atc_chan_is_enabled(atchan)) { | 1082 | atc_advance_work(atchan); |
1082 | atc_advance_work(atchan); | ||
1083 | } | ||
1084 | spin_unlock_irqrestore(&atchan->lock, flags); | 1083 | spin_unlock_irqrestore(&atchan->lock, flags); |
1085 | } | 1084 | } |
1086 | 1085 | ||
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index c599558faeda..43a5329d4483 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -1001,6 +1001,13 @@ static inline void convert_burst(u32 *maxburst) | |||
1001 | *maxburst = 0; | 1001 | *maxburst = 0; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | static inline void convert_slave_id(struct dw_dma_chan *dwc) | ||
1005 | { | ||
1006 | struct dw_dma *dw = to_dw_dma(dwc->chan.device); | ||
1007 | |||
1008 | dwc->dma_sconfig.slave_id -= dw->request_line_base; | ||
1009 | } | ||
1010 | |||
1004 | static int | 1011 | static int |
1005 | set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) | 1012 | set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) |
1006 | { | 1013 | { |
@@ -1015,6 +1022,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) | |||
1015 | 1022 | ||
1016 | convert_burst(&dwc->dma_sconfig.src_maxburst); | 1023 | convert_burst(&dwc->dma_sconfig.src_maxburst); |
1017 | convert_burst(&dwc->dma_sconfig.dst_maxburst); | 1024 | convert_burst(&dwc->dma_sconfig.dst_maxburst); |
1025 | convert_slave_id(dwc); | ||
1018 | 1026 | ||
1019 | return 0; | 1027 | return 0; |
1020 | } | 1028 | } |
@@ -1276,9 +1284,9 @@ static struct dma_chan *dw_dma_xlate(struct of_phandle_args *dma_spec, | |||
1276 | if (dma_spec->args_count != 3) | 1284 | if (dma_spec->args_count != 3) |
1277 | return NULL; | 1285 | return NULL; |
1278 | 1286 | ||
1279 | fargs.req = be32_to_cpup(dma_spec->args+0); | 1287 | fargs.req = dma_spec->args[0]; |
1280 | fargs.src = be32_to_cpup(dma_spec->args+1); | 1288 | fargs.src = dma_spec->args[1]; |
1281 | fargs.dst = be32_to_cpup(dma_spec->args+2); | 1289 | fargs.dst = dma_spec->args[2]; |
1282 | 1290 | ||
1283 | if (WARN_ON(fargs.req >= DW_DMA_MAX_NR_REQUESTS || | 1291 | if (WARN_ON(fargs.req >= DW_DMA_MAX_NR_REQUESTS || |
1284 | fargs.src >= dw->nr_masters || | 1292 | fargs.src >= dw->nr_masters || |
@@ -1628,6 +1636,7 @@ dw_dma_parse_dt(struct platform_device *pdev) | |||
1628 | 1636 | ||
1629 | static int dw_probe(struct platform_device *pdev) | 1637 | static int dw_probe(struct platform_device *pdev) |
1630 | { | 1638 | { |
1639 | const struct platform_device_id *match; | ||
1631 | struct dw_dma_platform_data *pdata; | 1640 | struct dw_dma_platform_data *pdata; |
1632 | struct resource *io; | 1641 | struct resource *io; |
1633 | struct dw_dma *dw; | 1642 | struct dw_dma *dw; |
@@ -1711,6 +1720,11 @@ static int dw_probe(struct platform_device *pdev) | |||
1711 | memcpy(dw->data_width, pdata->data_width, 4); | 1720 | memcpy(dw->data_width, pdata->data_width, 4); |
1712 | } | 1721 | } |
1713 | 1722 | ||
1723 | /* Get the base request line if set */ | ||
1724 | match = platform_get_device_id(pdev); | ||
1725 | if (match) | ||
1726 | dw->request_line_base = (unsigned int)match->driver_data; | ||
1727 | |||
1714 | /* Calculate all channel mask before DMA setup */ | 1728 | /* Calculate all channel mask before DMA setup */ |
1715 | dw->all_chan_mask = (1 << nr_channels) - 1; | 1729 | dw->all_chan_mask = (1 << nr_channels) - 1; |
1716 | 1730 | ||
@@ -1906,7 +1920,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table); | |||
1906 | #endif | 1920 | #endif |
1907 | 1921 | ||
1908 | static const struct platform_device_id dw_dma_ids[] = { | 1922 | static const struct platform_device_id dw_dma_ids[] = { |
1909 | { "INTL9C60", 0 }, | 1923 | /* Name, Request Line Base */ |
1924 | { "INTL9C60", (kernel_ulong_t)16 }, | ||
1910 | { } | 1925 | { } |
1911 | }; | 1926 | }; |
1912 | 1927 | ||
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index cf0ce5c77d60..4d02c3669b75 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -247,6 +247,7 @@ struct dw_dma { | |||
247 | /* hardware configuration */ | 247 | /* hardware configuration */ |
248 | unsigned char nr_masters; | 248 | unsigned char nr_masters; |
249 | unsigned char data_width[4]; | 249 | unsigned char data_width[4]; |
250 | unsigned int request_line_base; | ||
250 | 251 | ||
251 | struct dw_dma_chan chan[0]; | 252 | struct dw_dma_chan chan[0]; |
252 | }; | 253 | }; |
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index c4b4fd2acc42..08b43bf37158 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -276,12 +276,20 @@ static void omap_dma_issue_pending(struct dma_chan *chan) | |||
276 | 276 | ||
277 | spin_lock_irqsave(&c->vc.lock, flags); | 277 | spin_lock_irqsave(&c->vc.lock, flags); |
278 | if (vchan_issue_pending(&c->vc) && !c->desc) { | 278 | if (vchan_issue_pending(&c->vc) && !c->desc) { |
279 | struct omap_dmadev *d = to_omap_dma_dev(chan->device); | 279 | /* |
280 | spin_lock(&d->lock); | 280 | * c->cyclic is used only by audio and in this case the DMA need |
281 | if (list_empty(&c->node)) | 281 | * to be started without delay. |
282 | list_add_tail(&c->node, &d->pending); | 282 | */ |
283 | spin_unlock(&d->lock); | 283 | if (!c->cyclic) { |
284 | tasklet_schedule(&d->task); | 284 | struct omap_dmadev *d = to_omap_dma_dev(chan->device); |
285 | spin_lock(&d->lock); | ||
286 | if (list_empty(&c->node)) | ||
287 | list_add_tail(&c->node, &d->pending); | ||
288 | spin_unlock(&d->lock); | ||
289 | tasklet_schedule(&d->task); | ||
290 | } else { | ||
291 | omap_dma_start_desc(c); | ||
292 | } | ||
285 | } | 293 | } |
286 | spin_unlock_irqrestore(&c->vc.lock, flags); | 294 | spin_unlock_irqrestore(&c->vc.lock, flags); |
287 | } | 295 | } |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 718153122759..5dbc5946c4c3 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2882,7 +2882,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2882 | { | 2882 | { |
2883 | struct dma_pl330_platdata *pdat; | 2883 | struct dma_pl330_platdata *pdat; |
2884 | struct dma_pl330_dmac *pdmac; | 2884 | struct dma_pl330_dmac *pdmac; |
2885 | struct dma_pl330_chan *pch; | 2885 | struct dma_pl330_chan *pch, *_p; |
2886 | struct pl330_info *pi; | 2886 | struct pl330_info *pi; |
2887 | struct dma_device *pd; | 2887 | struct dma_device *pd; |
2888 | struct resource *res; | 2888 | struct resource *res; |
@@ -2984,7 +2984,16 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2984 | ret = dma_async_device_register(pd); | 2984 | ret = dma_async_device_register(pd); |
2985 | if (ret) { | 2985 | if (ret) { |
2986 | dev_err(&adev->dev, "unable to register DMAC\n"); | 2986 | dev_err(&adev->dev, "unable to register DMAC\n"); |
2987 | goto probe_err2; | 2987 | goto probe_err3; |
2988 | } | ||
2989 | |||
2990 | if (adev->dev.of_node) { | ||
2991 | ret = of_dma_controller_register(adev->dev.of_node, | ||
2992 | of_dma_pl330_xlate, pdmac); | ||
2993 | if (ret) { | ||
2994 | dev_err(&adev->dev, | ||
2995 | "unable to register DMA to the generic DT DMA helpers\n"); | ||
2996 | } | ||
2988 | } | 2997 | } |
2989 | 2998 | ||
2990 | dev_info(&adev->dev, | 2999 | dev_info(&adev->dev, |
@@ -2995,16 +3004,21 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2995 | pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan, | 3004 | pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan, |
2996 | pi->pcfg.num_peri, pi->pcfg.num_events); | 3005 | pi->pcfg.num_peri, pi->pcfg.num_events); |
2997 | 3006 | ||
2998 | ret = of_dma_controller_register(adev->dev.of_node, | ||
2999 | of_dma_pl330_xlate, pdmac); | ||
3000 | if (ret) { | ||
3001 | dev_err(&adev->dev, | ||
3002 | "unable to register DMA to the generic DT DMA helpers\n"); | ||
3003 | goto probe_err2; | ||
3004 | } | ||
3005 | |||
3006 | return 0; | 3007 | return 0; |
3008 | probe_err3: | ||
3009 | amba_set_drvdata(adev, NULL); | ||
3007 | 3010 | ||
3011 | /* Idle the DMAC */ | ||
3012 | list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels, | ||
3013 | chan.device_node) { | ||
3014 | |||
3015 | /* Remove the channel */ | ||
3016 | list_del(&pch->chan.device_node); | ||
3017 | |||
3018 | /* Flush the channel */ | ||
3019 | pl330_control(&pch->chan, DMA_TERMINATE_ALL, 0); | ||
3020 | pl330_free_chan_resources(&pch->chan); | ||
3021 | } | ||
3008 | probe_err2: | 3022 | probe_err2: |
3009 | pl330_del(pi); | 3023 | pl330_del(pi); |
3010 | probe_err1: | 3024 | probe_err1: |
@@ -3023,8 +3037,10 @@ static int pl330_remove(struct amba_device *adev) | |||
3023 | if (!pdmac) | 3037 | if (!pdmac) |
3024 | return 0; | 3038 | return 0; |
3025 | 3039 | ||
3026 | of_dma_controller_free(adev->dev.of_node); | 3040 | if (adev->dev.of_node) |
3041 | of_dma_controller_free(adev->dev.of_node); | ||
3027 | 3042 | ||
3043 | dma_async_device_unregister(&pdmac->ddma); | ||
3028 | amba_set_drvdata(adev, NULL); | 3044 | amba_set_drvdata(adev, NULL); |
3029 | 3045 | ||
3030 | /* Idle the DMAC */ | 3046 | /* Idle the DMAC */ |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 910b0116c128..e1d13c463c90 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -2048,12 +2048,18 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2048 | edac_dbg(1, "MC node: %d, csrow: %d\n", | 2048 | edac_dbg(1, "MC node: %d, csrow: %d\n", |
2049 | pvt->mc_node_id, i); | 2049 | pvt->mc_node_id, i); |
2050 | 2050 | ||
2051 | if (row_dct0) | 2051 | if (row_dct0) { |
2052 | nr_pages = amd64_csrow_nr_pages(pvt, 0, i); | 2052 | nr_pages = amd64_csrow_nr_pages(pvt, 0, i); |
2053 | csrow->channels[0]->dimm->nr_pages = nr_pages; | ||
2054 | } | ||
2053 | 2055 | ||
2054 | /* K8 has only one DCT */ | 2056 | /* K8 has only one DCT */ |
2055 | if (boot_cpu_data.x86 != 0xf && row_dct1) | 2057 | if (boot_cpu_data.x86 != 0xf && row_dct1) { |
2056 | nr_pages += amd64_csrow_nr_pages(pvt, 1, i); | 2058 | int row_dct1_pages = amd64_csrow_nr_pages(pvt, 1, i); |
2059 | |||
2060 | csrow->channels[1]->dimm->nr_pages = row_dct1_pages; | ||
2061 | nr_pages += row_dct1_pages; | ||
2062 | } | ||
2057 | 2063 | ||
2058 | mtype = amd64_determine_memory_type(pvt, i); | 2064 | mtype = amd64_determine_memory_type(pvt, i); |
2059 | 2065 | ||
@@ -2072,9 +2078,7 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2072 | dimm = csrow->channels[j]->dimm; | 2078 | dimm = csrow->channels[j]->dimm; |
2073 | dimm->mtype = mtype; | 2079 | dimm->mtype = mtype; |
2074 | dimm->edac_mode = edac_mode; | 2080 | dimm->edac_mode = edac_mode; |
2075 | dimm->nr_pages = nr_pages; | ||
2076 | } | 2081 | } |
2077 | csrow->nr_pages = nr_pages; | ||
2078 | } | 2082 | } |
2079 | 2083 | ||
2080 | return empty; | 2084 | return empty; |
@@ -2419,7 +2423,6 @@ static int amd64_init_one_instance(struct pci_dev *F2) | |||
2419 | 2423 | ||
2420 | mci->pvt_info = pvt; | 2424 | mci->pvt_info = pvt; |
2421 | mci->pdev = &pvt->F2->dev; | 2425 | mci->pdev = &pvt->F2->dev; |
2422 | mci->csbased = 1; | ||
2423 | 2426 | ||
2424 | setup_mci_misc_attrs(mci, fam_type); | 2427 | setup_mci_misc_attrs(mci, fam_type); |
2425 | 2428 | ||
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index cdb81aa73ab7..27e86d938262 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -86,7 +86,7 @@ static void edac_mc_dump_dimm(struct dimm_info *dimm, int number) | |||
86 | edac_dimm_info_location(dimm, location, sizeof(location)); | 86 | edac_dimm_info_location(dimm, location, sizeof(location)); |
87 | 87 | ||
88 | edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", | 88 | edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", |
89 | dimm->mci->mem_is_per_rank ? "rank" : "dimm", | 89 | dimm->mci->csbased ? "rank" : "dimm", |
90 | number, location, dimm->csrow, dimm->cschannel); | 90 | number, location, dimm->csrow, dimm->cschannel); |
91 | edac_dbg(4, " dimm = %p\n", dimm); | 91 | edac_dbg(4, " dimm = %p\n", dimm); |
92 | edac_dbg(4, " dimm->label = '%s'\n", dimm->label); | 92 | edac_dbg(4, " dimm->label = '%s'\n", dimm->label); |
@@ -341,7 +341,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
341 | memcpy(mci->layers, layers, sizeof(*layer) * n_layers); | 341 | memcpy(mci->layers, layers, sizeof(*layer) * n_layers); |
342 | mci->nr_csrows = tot_csrows; | 342 | mci->nr_csrows = tot_csrows; |
343 | mci->num_cschannel = tot_channels; | 343 | mci->num_cschannel = tot_channels; |
344 | mci->mem_is_per_rank = per_rank; | 344 | mci->csbased = per_rank; |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Alocate and fill the csrow/channels structs | 347 | * Alocate and fill the csrow/channels structs |
@@ -1235,7 +1235,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, | |||
1235 | * incrementing the compat API counters | 1235 | * incrementing the compat API counters |
1236 | */ | 1236 | */ |
1237 | edac_dbg(4, "%s csrows map: (%d,%d)\n", | 1237 | edac_dbg(4, "%s csrows map: (%d,%d)\n", |
1238 | mci->mem_is_per_rank ? "rank" : "dimm", | 1238 | mci->csbased ? "rank" : "dimm", |
1239 | dimm->csrow, dimm->cschannel); | 1239 | dimm->csrow, dimm->cschannel); |
1240 | if (row == -1) | 1240 | if (row == -1) |
1241 | row = dimm->csrow; | 1241 | row = dimm->csrow; |
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 4f4b6137d74e..5899a76eec3b 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -143,7 +143,7 @@ static const char *edac_caps[] = { | |||
143 | * and the per-dimm/per-rank one | 143 | * and the per-dimm/per-rank one |
144 | */ | 144 | */ |
145 | #define DEVICE_ATTR_LEGACY(_name, _mode, _show, _store) \ | 145 | #define DEVICE_ATTR_LEGACY(_name, _mode, _show, _store) \ |
146 | struct device_attribute dev_attr_legacy_##_name = __ATTR(_name, _mode, _show, _store) | 146 | static struct device_attribute dev_attr_legacy_##_name = __ATTR(_name, _mode, _show, _store) |
147 | 147 | ||
148 | struct dev_ch_attribute { | 148 | struct dev_ch_attribute { |
149 | struct device_attribute attr; | 149 | struct device_attribute attr; |
@@ -180,9 +180,6 @@ static ssize_t csrow_size_show(struct device *dev, | |||
180 | int i; | 180 | int i; |
181 | u32 nr_pages = 0; | 181 | u32 nr_pages = 0; |
182 | 182 | ||
183 | if (csrow->mci->csbased) | ||
184 | return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages)); | ||
185 | |||
186 | for (i = 0; i < csrow->nr_channels; i++) | 183 | for (i = 0; i < csrow->nr_channels; i++) |
187 | nr_pages += csrow->channels[i]->dimm->nr_pages; | 184 | nr_pages += csrow->channels[i]->dimm->nr_pages; |
188 | return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); | 185 | return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); |
@@ -612,7 +609,7 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci, | |||
612 | device_initialize(&dimm->dev); | 609 | device_initialize(&dimm->dev); |
613 | 610 | ||
614 | dimm->dev.parent = &mci->dev; | 611 | dimm->dev.parent = &mci->dev; |
615 | if (mci->mem_is_per_rank) | 612 | if (mci->csbased) |
616 | dev_set_name(&dimm->dev, "rank%d", index); | 613 | dev_set_name(&dimm->dev, "rank%d", index); |
617 | else | 614 | else |
618 | dev_set_name(&dimm->dev, "dimm%d", index); | 615 | dev_set_name(&dimm->dev, "dimm%d", index); |
@@ -778,14 +775,10 @@ static ssize_t mci_size_mb_show(struct device *dev, | |||
778 | for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { | 775 | for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { |
779 | struct csrow_info *csrow = mci->csrows[csrow_idx]; | 776 | struct csrow_info *csrow = mci->csrows[csrow_idx]; |
780 | 777 | ||
781 | if (csrow->mci->csbased) { | 778 | for (j = 0; j < csrow->nr_channels; j++) { |
782 | total_pages += csrow->nr_pages; | 779 | struct dimm_info *dimm = csrow->channels[j]->dimm; |
783 | } else { | ||
784 | for (j = 0; j < csrow->nr_channels; j++) { | ||
785 | struct dimm_info *dimm = csrow->channels[j]->dimm; | ||
786 | 780 | ||
787 | total_pages += dimm->nr_pages; | 781 | total_pages += dimm->nr_pages; |
788 | } | ||
789 | } | 782 | } |
790 | } | 783 | } |
791 | 784 | ||
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c index cdae207028a7..6c3fca97d346 100644 --- a/drivers/eisa/pci_eisa.c +++ b/drivers/eisa/pci_eisa.c | |||
@@ -19,10 +19,10 @@ | |||
19 | /* There is only *one* pci_eisa device per machine, right ? */ | 19 | /* There is only *one* pci_eisa device per machine, right ? */ |
20 | static struct eisa_root_device pci_eisa_root; | 20 | static struct eisa_root_device pci_eisa_root; |
21 | 21 | ||
22 | static int __init pci_eisa_init(struct pci_dev *pdev, | 22 | static int __init pci_eisa_init(struct pci_dev *pdev) |
23 | const struct pci_device_id *ent) | ||
24 | { | 23 | { |
25 | int rc; | 24 | int rc, i; |
25 | struct resource *res, *bus_res = NULL; | ||
26 | 26 | ||
27 | if ((rc = pci_enable_device (pdev))) { | 27 | if ((rc = pci_enable_device (pdev))) { |
28 | printk (KERN_ERR "pci_eisa : Could not enable device %s\n", | 28 | printk (KERN_ERR "pci_eisa : Could not enable device %s\n", |
@@ -30,9 +30,30 @@ static int __init pci_eisa_init(struct pci_dev *pdev, | |||
30 | return rc; | 30 | return rc; |
31 | } | 31 | } |
32 | 32 | ||
33 | /* | ||
34 | * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI | ||
35 | * device, so the resources available on EISA are the same as those | ||
36 | * available on the 82375 bus. This works the same as a PCI-PCI | ||
37 | * bridge in subtractive-decode mode (see pci_read_bridge_bases()). | ||
38 | * We assume other PCI-EISA bridges are similar. | ||
39 | * | ||
40 | * eisa_root_register() can only deal with a single io port resource, | ||
41 | * so we use the first valid io port resource. | ||
42 | */ | ||
43 | pci_bus_for_each_resource(pdev->bus, res, i) | ||
44 | if (res && (res->flags & IORESOURCE_IO)) { | ||
45 | bus_res = res; | ||
46 | break; | ||
47 | } | ||
48 | |||
49 | if (!bus_res) { | ||
50 | dev_err(&pdev->dev, "No resources available\n"); | ||
51 | return -1; | ||
52 | } | ||
53 | |||
33 | pci_eisa_root.dev = &pdev->dev; | 54 | pci_eisa_root.dev = &pdev->dev; |
34 | pci_eisa_root.res = pdev->bus->resource[0]; | 55 | pci_eisa_root.res = bus_res; |
35 | pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start; | 56 | pci_eisa_root.bus_base_addr = bus_res->start; |
36 | pci_eisa_root.slots = EISA_MAX_SLOTS; | 57 | pci_eisa_root.slots = EISA_MAX_SLOTS; |
37 | pci_eisa_root.dma_mask = pdev->dma_mask; | 58 | pci_eisa_root.dma_mask = pdev->dma_mask; |
38 | dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); | 59 | dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); |
@@ -45,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev, | |||
45 | return 0; | 66 | return 0; |
46 | } | 67 | } |
47 | 68 | ||
48 | static struct pci_device_id pci_eisa_pci_tbl[] = { | 69 | /* |
49 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 70 | * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init(). |
50 | PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 }, | 71 | * Otherwise pnp resource will get enabled early and could prevent eisa |
51 | { 0, } | 72 | * to be initialized. |
52 | }; | 73 | * Also need to make sure pci_eisa_init_early() is called after |
74 | * x86/pci_subsys_init(). | ||
75 | * So need to use subsys_initcall_sync with it. | ||
76 | */ | ||
77 | static int __init pci_eisa_init_early(void) | ||
78 | { | ||
79 | struct pci_dev *dev = NULL; | ||
80 | int ret; | ||
53 | 81 | ||
54 | static struct pci_driver __refdata pci_eisa_driver = { | 82 | for_each_pci_dev(dev) |
55 | .name = "pci_eisa", | 83 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) { |
56 | .id_table = pci_eisa_pci_tbl, | 84 | ret = pci_eisa_init(dev); |
57 | .probe = pci_eisa_init, | 85 | if (ret) |
58 | }; | 86 | return ret; |
87 | } | ||
59 | 88 | ||
60 | static int __init pci_eisa_init_module (void) | 89 | return 0; |
61 | { | ||
62 | return pci_register_driver (&pci_eisa_driver); | ||
63 | } | 90 | } |
64 | 91 | subsys_initcall_sync(pci_eisa_init_early); | |
65 | device_initcall(pci_eisa_init_module); | ||
66 | MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl); | ||
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index b70e3815c459..8f3c947b0029 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -32,6 +32,38 @@ | |||
32 | #define DEV_NAME "max77693-muic" | 32 | #define DEV_NAME "max77693-muic" |
33 | #define DELAY_MS_DEFAULT 20000 /* unit: millisecond */ | 33 | #define DELAY_MS_DEFAULT 20000 /* unit: millisecond */ |
34 | 34 | ||
35 | /* | ||
36 | * Default value of MAX77693 register to bring up MUIC device. | ||
37 | * If user don't set some initial value for MUIC device through platform data, | ||
38 | * extcon-max77693 driver use 'default_init_data' to bring up base operation | ||
39 | * of MAX77693 MUIC device. | ||
40 | */ | ||
41 | struct max77693_reg_data default_init_data[] = { | ||
42 | { | ||
43 | /* STATUS2 - [3]ChgDetRun */ | ||
44 | .addr = MAX77693_MUIC_REG_STATUS2, | ||
45 | .data = STATUS2_CHGDETRUN_MASK, | ||
46 | }, { | ||
47 | /* INTMASK1 - Unmask [3]ADC1KM,[0]ADCM */ | ||
48 | .addr = MAX77693_MUIC_REG_INTMASK1, | ||
49 | .data = INTMASK1_ADC1K_MASK | ||
50 | | INTMASK1_ADC_MASK, | ||
51 | }, { | ||
52 | /* INTMASK2 - Unmask [0]ChgTypM */ | ||
53 | .addr = MAX77693_MUIC_REG_INTMASK2, | ||
54 | .data = INTMASK2_CHGTYP_MASK, | ||
55 | }, { | ||
56 | /* INTMASK3 - Mask all of interrupts */ | ||
57 | .addr = MAX77693_MUIC_REG_INTMASK3, | ||
58 | .data = 0x0, | ||
59 | }, { | ||
60 | /* CDETCTRL2 */ | ||
61 | .addr = MAX77693_MUIC_REG_CDETCTRL2, | ||
62 | .data = CDETCTRL2_VIDRMEN_MASK | ||
63 | | CDETCTRL2_DXOVPEN_MASK, | ||
64 | }, | ||
65 | }; | ||
66 | |||
35 | enum max77693_muic_adc_debounce_time { | 67 | enum max77693_muic_adc_debounce_time { |
36 | ADC_DEBOUNCE_TIME_5MS = 0, | 68 | ADC_DEBOUNCE_TIME_5MS = 0, |
37 | ADC_DEBOUNCE_TIME_10MS, | 69 | ADC_DEBOUNCE_TIME_10MS, |
@@ -1045,8 +1077,9 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1045 | { | 1077 | { |
1046 | struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); | 1078 | struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); |
1047 | struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev); | 1079 | struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev); |
1048 | struct max77693_muic_platform_data *muic_pdata = pdata->muic_data; | ||
1049 | struct max77693_muic_info *info; | 1080 | struct max77693_muic_info *info; |
1081 | struct max77693_reg_data *init_data; | ||
1082 | int num_init_data; | ||
1050 | int delay_jiffies; | 1083 | int delay_jiffies; |
1051 | int ret; | 1084 | int ret; |
1052 | int i; | 1085 | int i; |
@@ -1145,15 +1178,25 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1145 | goto err_irq; | 1178 | goto err_irq; |
1146 | } | 1179 | } |
1147 | 1180 | ||
1148 | /* Initialize MUIC register by using platform data */ | 1181 | |
1149 | for (i = 0 ; i < muic_pdata->num_init_data ; i++) { | 1182 | /* Initialize MUIC register by using platform data or default data */ |
1150 | enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR; | 1183 | if (pdata->muic_data) { |
1184 | init_data = pdata->muic_data->init_data; | ||
1185 | num_init_data = pdata->muic_data->num_init_data; | ||
1186 | } else { | ||
1187 | init_data = default_init_data; | ||
1188 | num_init_data = ARRAY_SIZE(default_init_data); | ||
1189 | } | ||
1190 | |||
1191 | for (i = 0 ; i < num_init_data ; i++) { | ||
1192 | enum max77693_irq_source irq_src | ||
1193 | = MAX77693_IRQ_GROUP_NR; | ||
1151 | 1194 | ||
1152 | max77693_write_reg(info->max77693->regmap_muic, | 1195 | max77693_write_reg(info->max77693->regmap_muic, |
1153 | muic_pdata->init_data[i].addr, | 1196 | init_data[i].addr, |
1154 | muic_pdata->init_data[i].data); | 1197 | init_data[i].data); |
1155 | 1198 | ||
1156 | switch (muic_pdata->init_data[i].addr) { | 1199 | switch (init_data[i].addr) { |
1157 | case MAX77693_MUIC_REG_INTMASK1: | 1200 | case MAX77693_MUIC_REG_INTMASK1: |
1158 | irq_src = MUIC_INT1; | 1201 | irq_src = MUIC_INT1; |
1159 | break; | 1202 | break; |
@@ -1167,22 +1210,40 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1167 | 1210 | ||
1168 | if (irq_src < MAX77693_IRQ_GROUP_NR) | 1211 | if (irq_src < MAX77693_IRQ_GROUP_NR) |
1169 | info->max77693->irq_masks_cur[irq_src] | 1212 | info->max77693->irq_masks_cur[irq_src] |
1170 | = muic_pdata->init_data[i].data; | 1213 | = init_data[i].data; |
1171 | } | 1214 | } |
1172 | 1215 | ||
1173 | /* | 1216 | if (pdata->muic_data) { |
1174 | * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB | 1217 | struct max77693_muic_platform_data *muic_pdata = pdata->muic_data; |
1175 | * h/w path of COMP2/COMN1 on CONTROL1 register. | ||
1176 | */ | ||
1177 | if (muic_pdata->path_uart) | ||
1178 | info->path_uart = muic_pdata->path_uart; | ||
1179 | else | ||
1180 | info->path_uart = CONTROL1_SW_UART; | ||
1181 | 1218 | ||
1182 | if (muic_pdata->path_usb) | 1219 | /* |
1183 | info->path_usb = muic_pdata->path_usb; | 1220 | * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB |
1184 | else | 1221 | * h/w path of COMP2/COMN1 on CONTROL1 register. |
1222 | */ | ||
1223 | if (muic_pdata->path_uart) | ||
1224 | info->path_uart = muic_pdata->path_uart; | ||
1225 | else | ||
1226 | info->path_uart = CONTROL1_SW_UART; | ||
1227 | |||
1228 | if (muic_pdata->path_usb) | ||
1229 | info->path_usb = muic_pdata->path_usb; | ||
1230 | else | ||
1231 | info->path_usb = CONTROL1_SW_USB; | ||
1232 | |||
1233 | /* | ||
1234 | * Default delay time for detecting cable state | ||
1235 | * after certain time. | ||
1236 | */ | ||
1237 | if (muic_pdata->detcable_delay_ms) | ||
1238 | delay_jiffies = | ||
1239 | msecs_to_jiffies(muic_pdata->detcable_delay_ms); | ||
1240 | else | ||
1241 | delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); | ||
1242 | } else { | ||
1185 | info->path_usb = CONTROL1_SW_USB; | 1243 | info->path_usb = CONTROL1_SW_USB; |
1244 | info->path_uart = CONTROL1_SW_UART; | ||
1245 | delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); | ||
1246 | } | ||
1186 | 1247 | ||
1187 | /* Set initial path for UART */ | 1248 | /* Set initial path for UART */ |
1188 | max77693_muic_set_path(info, info->path_uart, true); | 1249 | max77693_muic_set_path(info, info->path_uart, true); |
@@ -1208,10 +1269,6 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1208 | * driver should notify cable state to upper layer. | 1269 | * driver should notify cable state to upper layer. |
1209 | */ | 1270 | */ |
1210 | INIT_DELAYED_WORK(&info->wq_detcable, max77693_muic_detect_cable_wq); | 1271 | INIT_DELAYED_WORK(&info->wq_detcable, max77693_muic_detect_cable_wq); |
1211 | if (muic_pdata->detcable_delay_ms) | ||
1212 | delay_jiffies = msecs_to_jiffies(muic_pdata->detcable_delay_ms); | ||
1213 | else | ||
1214 | delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); | ||
1215 | schedule_delayed_work(&info->wq_detcable, delay_jiffies); | 1272 | schedule_delayed_work(&info->wq_detcable, delay_jiffies); |
1216 | 1273 | ||
1217 | return ret; | 1274 | return ret; |
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index e636d950ad6c..69641bcae325 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
@@ -712,29 +712,45 @@ static int max8997_muic_probe(struct platform_device *pdev) | |||
712 | goto err_irq; | 712 | goto err_irq; |
713 | } | 713 | } |
714 | 714 | ||
715 | /* Initialize registers according to platform data */ | ||
716 | if (pdata->muic_pdata) { | 715 | if (pdata->muic_pdata) { |
717 | struct max8997_muic_platform_data *mdata = info->muic_pdata; | 716 | struct max8997_muic_platform_data *muic_pdata |
718 | 717 | = pdata->muic_pdata; | |
719 | for (i = 0; i < mdata->num_init_data; i++) { | 718 | |
720 | max8997_write_reg(info->muic, mdata->init_data[i].addr, | 719 | /* Initialize registers according to platform data */ |
721 | mdata->init_data[i].data); | 720 | for (i = 0; i < muic_pdata->num_init_data; i++) { |
721 | max8997_write_reg(info->muic, | ||
722 | muic_pdata->init_data[i].addr, | ||
723 | muic_pdata->init_data[i].data); | ||
722 | } | 724 | } |
723 | } | ||
724 | 725 | ||
725 | /* | 726 | /* |
726 | * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB | 727 | * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB |
727 | * h/w path of COMP2/COMN1 on CONTROL1 register. | 728 | * h/w path of COMP2/COMN1 on CONTROL1 register. |
728 | */ | 729 | */ |
729 | if (pdata->muic_pdata->path_uart) | 730 | if (muic_pdata->path_uart) |
730 | info->path_uart = pdata->muic_pdata->path_uart; | 731 | info->path_uart = muic_pdata->path_uart; |
731 | else | 732 | else |
732 | info->path_uart = CONTROL1_SW_UART; | 733 | info->path_uart = CONTROL1_SW_UART; |
733 | 734 | ||
734 | if (pdata->muic_pdata->path_usb) | 735 | if (muic_pdata->path_usb) |
735 | info->path_usb = pdata->muic_pdata->path_usb; | 736 | info->path_usb = muic_pdata->path_usb; |
736 | else | 737 | else |
738 | info->path_usb = CONTROL1_SW_USB; | ||
739 | |||
740 | /* | ||
741 | * Default delay time for detecting cable state | ||
742 | * after certain time. | ||
743 | */ | ||
744 | if (muic_pdata->detcable_delay_ms) | ||
745 | delay_jiffies = | ||
746 | msecs_to_jiffies(muic_pdata->detcable_delay_ms); | ||
747 | else | ||
748 | delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); | ||
749 | } else { | ||
750 | info->path_uart = CONTROL1_SW_UART; | ||
737 | info->path_usb = CONTROL1_SW_USB; | 751 | info->path_usb = CONTROL1_SW_USB; |
752 | delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); | ||
753 | } | ||
738 | 754 | ||
739 | /* Set initial path for UART */ | 755 | /* Set initial path for UART */ |
740 | max8997_muic_set_path(info, info->path_uart, true); | 756 | max8997_muic_set_path(info, info->path_uart, true); |
@@ -751,10 +767,6 @@ static int max8997_muic_probe(struct platform_device *pdev) | |||
751 | * driver should notify cable state to upper layer. | 767 | * driver should notify cable state to upper layer. |
752 | */ | 768 | */ |
753 | INIT_DELAYED_WORK(&info->wq_detcable, max8997_muic_detect_cable_wq); | 769 | INIT_DELAYED_WORK(&info->wq_detcable, max8997_muic_detect_cable_wq); |
754 | if (pdata->muic_pdata->detcable_delay_ms) | ||
755 | delay_jiffies = msecs_to_jiffies(pdata->muic_pdata->detcable_delay_ms); | ||
756 | else | ||
757 | delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); | ||
758 | schedule_delayed_work(&info->wq_detcable, delay_jiffies); | 770 | schedule_delayed_work(&info->wq_detcable, delay_jiffies); |
759 | 771 | ||
760 | return 0; | 772 | return 0; |
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 9b00072a020f..3e532002e4d1 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -39,6 +39,7 @@ config FIRMWARE_MEMMAP | |||
39 | config EFI_VARS | 39 | config EFI_VARS |
40 | tristate "EFI Variable Support via sysfs" | 40 | tristate "EFI Variable Support via sysfs" |
41 | depends on EFI | 41 | depends on EFI |
42 | select UCS2_STRING | ||
42 | default n | 43 | default n |
43 | help | 44 | help |
44 | If you say Y here, you are able to get EFI (Extensible Firmware | 45 | If you say Y here, you are able to get EFI (Extensible Firmware |
@@ -53,6 +54,24 @@ config EFI_VARS | |||
53 | Subsequent efibootmgr releases may be found at: | 54 | Subsequent efibootmgr releases may be found at: |
54 | <http://linux.dell.com/efibootmgr> | 55 | <http://linux.dell.com/efibootmgr> |
55 | 56 | ||
57 | config EFI_VARS_PSTORE | ||
58 | bool "Register efivars backend for pstore" | ||
59 | depends on EFI_VARS && PSTORE | ||
60 | default y | ||
61 | help | ||
62 | Say Y here to enable use efivars as a backend to pstore. This | ||
63 | will allow writing console messages, crash dumps, or anything | ||
64 | else supported by pstore to EFI variables. | ||
65 | |||
66 | config EFI_VARS_PSTORE_DEFAULT_DISABLE | ||
67 | bool "Disable using efivars as a pstore backend by default" | ||
68 | depends on EFI_VARS_PSTORE | ||
69 | default n | ||
70 | help | ||
71 | Saying Y here will disable the use of efivars as a storage | ||
72 | backend for pstore by default. This setting can be overridden | ||
73 | using the efivars module's pstore_disable parameter. | ||
74 | |||
56 | config EFI_PCDP | 75 | config EFI_PCDP |
57 | bool "Console device selection via EFI PCDP or HCDP table" | 76 | bool "Console device selection via EFI PCDP or HCDP table" |
58 | depends on ACPI && EFI && IA64 | 77 | depends on ACPI && EFI && IA64 |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index fe62aa392239..182ce9471175 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #include <linux/slab.h> | 80 | #include <linux/slab.h> |
81 | #include <linux/pstore.h> | 81 | #include <linux/pstore.h> |
82 | #include <linux/ctype.h> | 82 | #include <linux/ctype.h> |
83 | #include <linux/ucs2_string.h> | ||
83 | 84 | ||
84 | #include <linux/fs.h> | 85 | #include <linux/fs.h> |
85 | #include <linux/ramfs.h> | 86 | #include <linux/ramfs.h> |
@@ -103,6 +104,11 @@ MODULE_VERSION(EFIVARS_VERSION); | |||
103 | */ | 104 | */ |
104 | #define GUID_LEN 36 | 105 | #define GUID_LEN 36 |
105 | 106 | ||
107 | static bool efivars_pstore_disable = | ||
108 | IS_ENABLED(CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE); | ||
109 | |||
110 | module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644); | ||
111 | |||
106 | /* | 112 | /* |
107 | * The maximum size of VariableName + Data = 1024 | 113 | * The maximum size of VariableName + Data = 1024 |
108 | * Therefore, it's reasonable to save that much | 114 | * Therefore, it's reasonable to save that much |
@@ -165,51 +171,7 @@ efivar_create_sysfs_entry(struct efivars *efivars, | |||
165 | 171 | ||
166 | static void efivar_update_sysfs_entries(struct work_struct *); | 172 | static void efivar_update_sysfs_entries(struct work_struct *); |
167 | static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); | 173 | static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); |
168 | 174 | static bool efivar_wq_enabled = true; | |
169 | /* Return the number of unicode characters in data */ | ||
170 | static unsigned long | ||
171 | utf16_strnlen(efi_char16_t *s, size_t maxlength) | ||
172 | { | ||
173 | unsigned long length = 0; | ||
174 | |||
175 | while (*s++ != 0 && length < maxlength) | ||
176 | length++; | ||
177 | return length; | ||
178 | } | ||
179 | |||
180 | static inline unsigned long | ||
181 | utf16_strlen(efi_char16_t *s) | ||
182 | { | ||
183 | return utf16_strnlen(s, ~0UL); | ||
184 | } | ||
185 | |||
186 | /* | ||
187 | * Return the number of bytes is the length of this string | ||
188 | * Note: this is NOT the same as the number of unicode characters | ||
189 | */ | ||
190 | static inline unsigned long | ||
191 | utf16_strsize(efi_char16_t *data, unsigned long maxlength) | ||
192 | { | ||
193 | return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t); | ||
194 | } | ||
195 | |||
196 | static inline int | ||
197 | utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) | ||
198 | { | ||
199 | while (1) { | ||
200 | if (len == 0) | ||
201 | return 0; | ||
202 | if (*a < *b) | ||
203 | return -1; | ||
204 | if (*a > *b) | ||
205 | return 1; | ||
206 | if (*a == 0) /* implies *b == 0 */ | ||
207 | return 0; | ||
208 | a++; | ||
209 | b++; | ||
210 | len--; | ||
211 | } | ||
212 | } | ||
213 | 175 | ||
214 | static bool | 176 | static bool |
215 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, | 177 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, |
@@ -262,7 +224,7 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer, | |||
262 | u16 filepathlength; | 224 | u16 filepathlength; |
263 | int i, desclength = 0, namelen; | 225 | int i, desclength = 0, namelen; |
264 | 226 | ||
265 | namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName)); | 227 | namelen = ucs2_strnlen(var->VariableName, sizeof(var->VariableName)); |
266 | 228 | ||
267 | /* Either "Boot" or "Driver" followed by four digits of hex */ | 229 | /* Either "Boot" or "Driver" followed by four digits of hex */ |
268 | for (i = match; i < match+4; i++) { | 230 | for (i = match; i < match+4; i++) { |
@@ -285,7 +247,7 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer, | |||
285 | * There's no stored length for the description, so it has to be | 247 | * There's no stored length for the description, so it has to be |
286 | * found by hand | 248 | * found by hand |
287 | */ | 249 | */ |
288 | desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | 250 | desclength = ucs2_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; |
289 | 251 | ||
290 | /* Each boot entry must have a descriptor */ | 252 | /* Each boot entry must have a descriptor */ |
291 | if (!desclength) | 253 | if (!desclength) |
@@ -430,24 +392,12 @@ static efi_status_t | |||
430 | check_var_size_locked(struct efivars *efivars, u32 attributes, | 392 | check_var_size_locked(struct efivars *efivars, u32 attributes, |
431 | unsigned long size) | 393 | unsigned long size) |
432 | { | 394 | { |
433 | u64 storage_size, remaining_size, max_size; | ||
434 | efi_status_t status; | ||
435 | const struct efivar_operations *fops = efivars->ops; | 395 | const struct efivar_operations *fops = efivars->ops; |
436 | 396 | ||
437 | if (!efivars->ops->query_variable_info) | 397 | if (!efivars->ops->query_variable_store) |
438 | return EFI_UNSUPPORTED; | 398 | return EFI_UNSUPPORTED; |
439 | 399 | ||
440 | status = fops->query_variable_info(attributes, &storage_size, | 400 | return fops->query_variable_store(attributes, size); |
441 | &remaining_size, &max_size); | ||
442 | |||
443 | if (status != EFI_SUCCESS) | ||
444 | return status; | ||
445 | |||
446 | if (!storage_size || size > remaining_size || size > max_size || | ||
447 | (remaining_size - size) < (storage_size / 2)) | ||
448 | return EFI_OUT_OF_RESOURCES; | ||
449 | |||
450 | return status; | ||
451 | } | 401 | } |
452 | 402 | ||
453 | 403 | ||
@@ -587,7 +537,7 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | |||
587 | spin_lock_irq(&efivars->lock); | 537 | spin_lock_irq(&efivars->lock); |
588 | 538 | ||
589 | status = check_var_size_locked(efivars, new_var->Attributes, | 539 | status = check_var_size_locked(efivars, new_var->Attributes, |
590 | new_var->DataSize + utf16_strsize(new_var->VariableName, 1024)); | 540 | new_var->DataSize + ucs2_strsize(new_var->VariableName, 1024)); |
591 | 541 | ||
592 | if (status == EFI_SUCCESS || status == EFI_UNSUPPORTED) | 542 | if (status == EFI_SUCCESS || status == EFI_UNSUPPORTED) |
593 | status = efivars->ops->set_variable(new_var->VariableName, | 543 | status = efivars->ops->set_variable(new_var->VariableName, |
@@ -765,7 +715,7 @@ static ssize_t efivarfs_file_write(struct file *file, | |||
765 | * QueryVariableInfo() isn't supported by the firmware. | 715 | * QueryVariableInfo() isn't supported by the firmware. |
766 | */ | 716 | */ |
767 | 717 | ||
768 | varsize = datasize + utf16_strsize(var->var.VariableName, 1024); | 718 | varsize = datasize + ucs2_strsize(var->var.VariableName, 1024); |
769 | status = check_var_size(efivars, attributes, varsize); | 719 | status = check_var_size(efivars, attributes, varsize); |
770 | 720 | ||
771 | if (status != EFI_SUCCESS) { | 721 | if (status != EFI_SUCCESS) { |
@@ -1217,7 +1167,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | |||
1217 | 1167 | ||
1218 | inode = NULL; | 1168 | inode = NULL; |
1219 | 1169 | ||
1220 | len = utf16_strlen(entry->var.VariableName); | 1170 | len = ucs2_strlen(entry->var.VariableName); |
1221 | 1171 | ||
1222 | /* name, plus '-', plus GUID, plus NUL*/ | 1172 | /* name, plus '-', plus GUID, plus NUL*/ |
1223 | name = kmalloc(len + 1 + GUID_LEN + 1, GFP_ATOMIC); | 1173 | name = kmalloc(len + 1 + GUID_LEN + 1, GFP_ATOMIC); |
@@ -1309,9 +1259,7 @@ static const struct inode_operations efivarfs_dir_inode_operations = { | |||
1309 | .create = efivarfs_create, | 1259 | .create = efivarfs_create, |
1310 | }; | 1260 | }; |
1311 | 1261 | ||
1312 | static struct pstore_info efi_pstore_info; | 1262 | #ifdef CONFIG_EFI_VARS_PSTORE |
1313 | |||
1314 | #ifdef CONFIG_PSTORE | ||
1315 | 1263 | ||
1316 | static int efi_pstore_open(struct pstore_info *psi) | 1264 | static int efi_pstore_open(struct pstore_info *psi) |
1317 | { | 1265 | { |
@@ -1441,7 +1389,7 @@ static int efi_pstore_write(enum pstore_type_id type, | |||
1441 | 1389 | ||
1442 | spin_unlock_irqrestore(&efivars->lock, flags); | 1390 | spin_unlock_irqrestore(&efivars->lock, flags); |
1443 | 1391 | ||
1444 | if (reason == KMSG_DUMP_OOPS) | 1392 | if (reason == KMSG_DUMP_OOPS && efivar_wq_enabled) |
1445 | schedule_work(&efivar_work); | 1393 | schedule_work(&efivar_work); |
1446 | 1394 | ||
1447 | *id = part; | 1395 | *id = part; |
@@ -1477,8 +1425,8 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
1477 | 1425 | ||
1478 | if (efi_guidcmp(entry->var.VendorGuid, vendor)) | 1426 | if (efi_guidcmp(entry->var.VendorGuid, vendor)) |
1479 | continue; | 1427 | continue; |
1480 | if (utf16_strncmp(entry->var.VariableName, efi_name, | 1428 | if (ucs2_strncmp(entry->var.VariableName, efi_name, |
1481 | utf16_strlen(efi_name))) { | 1429 | ucs2_strlen(efi_name))) { |
1482 | /* | 1430 | /* |
1483 | * Check if an old format, | 1431 | * Check if an old format, |
1484 | * which doesn't support holding | 1432 | * which doesn't support holding |
@@ -1490,8 +1438,8 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
1490 | for (i = 0; i < DUMP_NAME_LEN; i++) | 1438 | for (i = 0; i < DUMP_NAME_LEN; i++) |
1491 | efi_name_old[i] = name_old[i]; | 1439 | efi_name_old[i] = name_old[i]; |
1492 | 1440 | ||
1493 | if (utf16_strncmp(entry->var.VariableName, efi_name_old, | 1441 | if (ucs2_strncmp(entry->var.VariableName, efi_name_old, |
1494 | utf16_strlen(efi_name_old))) | 1442 | ucs2_strlen(efi_name_old))) |
1495 | continue; | 1443 | continue; |
1496 | } | 1444 | } |
1497 | 1445 | ||
@@ -1514,38 +1462,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
1514 | 1462 | ||
1515 | return 0; | 1463 | return 0; |
1516 | } | 1464 | } |
1517 | #else | ||
1518 | static int efi_pstore_open(struct pstore_info *psi) | ||
1519 | { | ||
1520 | return 0; | ||
1521 | } | ||
1522 | |||
1523 | static int efi_pstore_close(struct pstore_info *psi) | ||
1524 | { | ||
1525 | return 0; | ||
1526 | } | ||
1527 | |||
1528 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count, | ||
1529 | struct timespec *timespec, | ||
1530 | char **buf, struct pstore_info *psi) | ||
1531 | { | ||
1532 | return -1; | ||
1533 | } | ||
1534 | |||
1535 | static int efi_pstore_write(enum pstore_type_id type, | ||
1536 | enum kmsg_dump_reason reason, u64 *id, | ||
1537 | unsigned int part, int count, size_t size, | ||
1538 | struct pstore_info *psi) | ||
1539 | { | ||
1540 | return 0; | ||
1541 | } | ||
1542 | |||
1543 | static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | ||
1544 | struct timespec time, struct pstore_info *psi) | ||
1545 | { | ||
1546 | return 0; | ||
1547 | } | ||
1548 | #endif | ||
1549 | 1465 | ||
1550 | static struct pstore_info efi_pstore_info = { | 1466 | static struct pstore_info efi_pstore_info = { |
1551 | .owner = THIS_MODULE, | 1467 | .owner = THIS_MODULE, |
@@ -1557,6 +1473,24 @@ static struct pstore_info efi_pstore_info = { | |||
1557 | .erase = efi_pstore_erase, | 1473 | .erase = efi_pstore_erase, |
1558 | }; | 1474 | }; |
1559 | 1475 | ||
1476 | static void efivar_pstore_register(struct efivars *efivars) | ||
1477 | { | ||
1478 | efivars->efi_pstore_info = efi_pstore_info; | ||
1479 | efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); | ||
1480 | if (efivars->efi_pstore_info.buf) { | ||
1481 | efivars->efi_pstore_info.bufsize = 1024; | ||
1482 | efivars->efi_pstore_info.data = efivars; | ||
1483 | spin_lock_init(&efivars->efi_pstore_info.buf_lock); | ||
1484 | pstore_register(&efivars->efi_pstore_info); | ||
1485 | } | ||
1486 | } | ||
1487 | #else | ||
1488 | static void efivar_pstore_register(struct efivars *efivars) | ||
1489 | { | ||
1490 | return; | ||
1491 | } | ||
1492 | #endif | ||
1493 | |||
1560 | static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | 1494 | static ssize_t efivar_create(struct file *filp, struct kobject *kobj, |
1561 | struct bin_attribute *bin_attr, | 1495 | struct bin_attribute *bin_attr, |
1562 | char *buf, loff_t pos, size_t count) | 1496 | char *buf, loff_t pos, size_t count) |
@@ -1583,8 +1517,8 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
1583 | * Does this variable already exist? | 1517 | * Does this variable already exist? |
1584 | */ | 1518 | */ |
1585 | list_for_each_entry_safe(search_efivar, n, &efivars->list, list) { | 1519 | list_for_each_entry_safe(search_efivar, n, &efivars->list, list) { |
1586 | strsize1 = utf16_strsize(search_efivar->var.VariableName, 1024); | 1520 | strsize1 = ucs2_strsize(search_efivar->var.VariableName, 1024); |
1587 | strsize2 = utf16_strsize(new_var->VariableName, 1024); | 1521 | strsize2 = ucs2_strsize(new_var->VariableName, 1024); |
1588 | if (strsize1 == strsize2 && | 1522 | if (strsize1 == strsize2 && |
1589 | !memcmp(&(search_efivar->var.VariableName), | 1523 | !memcmp(&(search_efivar->var.VariableName), |
1590 | new_var->VariableName, strsize1) && | 1524 | new_var->VariableName, strsize1) && |
@@ -1600,7 +1534,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
1600 | } | 1534 | } |
1601 | 1535 | ||
1602 | status = check_var_size_locked(efivars, new_var->Attributes, | 1536 | status = check_var_size_locked(efivars, new_var->Attributes, |
1603 | new_var->DataSize + utf16_strsize(new_var->VariableName, 1024)); | 1537 | new_var->DataSize + ucs2_strsize(new_var->VariableName, 1024)); |
1604 | 1538 | ||
1605 | if (status && status != EFI_UNSUPPORTED) { | 1539 | if (status && status != EFI_UNSUPPORTED) { |
1606 | spin_unlock_irq(&efivars->lock); | 1540 | spin_unlock_irq(&efivars->lock); |
@@ -1624,7 +1558,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
1624 | 1558 | ||
1625 | /* Create the entry in sysfs. Locking is not required here */ | 1559 | /* Create the entry in sysfs. Locking is not required here */ |
1626 | status = efivar_create_sysfs_entry(efivars, | 1560 | status = efivar_create_sysfs_entry(efivars, |
1627 | utf16_strsize(new_var->VariableName, | 1561 | ucs2_strsize(new_var->VariableName, |
1628 | 1024), | 1562 | 1024), |
1629 | new_var->VariableName, | 1563 | new_var->VariableName, |
1630 | &new_var->VendorGuid); | 1564 | &new_var->VendorGuid); |
@@ -1654,8 +1588,8 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | |||
1654 | * Does this variable already exist? | 1588 | * Does this variable already exist? |
1655 | */ | 1589 | */ |
1656 | list_for_each_entry_safe(search_efivar, n, &efivars->list, list) { | 1590 | list_for_each_entry_safe(search_efivar, n, &efivars->list, list) { |
1657 | strsize1 = utf16_strsize(search_efivar->var.VariableName, 1024); | 1591 | strsize1 = ucs2_strsize(search_efivar->var.VariableName, 1024); |
1658 | strsize2 = utf16_strsize(del_var->VariableName, 1024); | 1592 | strsize2 = ucs2_strsize(del_var->VariableName, 1024); |
1659 | if (strsize1 == strsize2 && | 1593 | if (strsize1 == strsize2 && |
1660 | !memcmp(&(search_efivar->var.VariableName), | 1594 | !memcmp(&(search_efivar->var.VariableName), |
1661 | del_var->VariableName, strsize1) && | 1595 | del_var->VariableName, strsize1) && |
@@ -1701,9 +1635,9 @@ static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor) | |||
1701 | unsigned long strsize1, strsize2; | 1635 | unsigned long strsize1, strsize2; |
1702 | bool found = false; | 1636 | bool found = false; |
1703 | 1637 | ||
1704 | strsize1 = utf16_strsize(variable_name, 1024); | 1638 | strsize1 = ucs2_strsize(variable_name, 1024); |
1705 | list_for_each_entry_safe(entry, n, &efivars->list, list) { | 1639 | list_for_each_entry_safe(entry, n, &efivars->list, list) { |
1706 | strsize2 = utf16_strsize(entry->var.VariableName, 1024); | 1640 | strsize2 = ucs2_strsize(entry->var.VariableName, 1024); |
1707 | if (strsize1 == strsize2 && | 1641 | if (strsize1 == strsize2 && |
1708 | !memcmp(variable_name, &(entry->var.VariableName), | 1642 | !memcmp(variable_name, &(entry->var.VariableName), |
1709 | strsize2) && | 1643 | strsize2) && |
@@ -1716,6 +1650,31 @@ static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor) | |||
1716 | return found; | 1650 | return found; |
1717 | } | 1651 | } |
1718 | 1652 | ||
1653 | /* | ||
1654 | * Returns the size of variable_name, in bytes, including the | ||
1655 | * terminating NULL character, or variable_name_size if no NULL | ||
1656 | * character is found among the first variable_name_size bytes. | ||
1657 | */ | ||
1658 | static unsigned long var_name_strnsize(efi_char16_t *variable_name, | ||
1659 | unsigned long variable_name_size) | ||
1660 | { | ||
1661 | unsigned long len; | ||
1662 | efi_char16_t c; | ||
1663 | |||
1664 | /* | ||
1665 | * The variable name is, by definition, a NULL-terminated | ||
1666 | * string, so make absolutely sure that variable_name_size is | ||
1667 | * the value we expect it to be. If not, return the real size. | ||
1668 | */ | ||
1669 | for (len = 2; len <= variable_name_size; len += sizeof(c)) { | ||
1670 | c = variable_name[(len / sizeof(c)) - 1]; | ||
1671 | if (!c) | ||
1672 | break; | ||
1673 | } | ||
1674 | |||
1675 | return min(len, variable_name_size); | ||
1676 | } | ||
1677 | |||
1719 | static void efivar_update_sysfs_entries(struct work_struct *work) | 1678 | static void efivar_update_sysfs_entries(struct work_struct *work) |
1720 | { | 1679 | { |
1721 | struct efivars *efivars = &__efivars; | 1680 | struct efivars *efivars = &__efivars; |
@@ -1756,10 +1715,13 @@ static void efivar_update_sysfs_entries(struct work_struct *work) | |||
1756 | if (!found) { | 1715 | if (!found) { |
1757 | kfree(variable_name); | 1716 | kfree(variable_name); |
1758 | break; | 1717 | break; |
1759 | } else | 1718 | } else { |
1719 | variable_name_size = var_name_strnsize(variable_name, | ||
1720 | variable_name_size); | ||
1760 | efivar_create_sysfs_entry(efivars, | 1721 | efivar_create_sysfs_entry(efivars, |
1761 | variable_name_size, | 1722 | variable_name_size, |
1762 | variable_name, &vendor); | 1723 | variable_name, &vendor); |
1724 | } | ||
1763 | } | 1725 | } |
1764 | } | 1726 | } |
1765 | 1727 | ||
@@ -1958,6 +1920,35 @@ void unregister_efivars(struct efivars *efivars) | |||
1958 | } | 1920 | } |
1959 | EXPORT_SYMBOL_GPL(unregister_efivars); | 1921 | EXPORT_SYMBOL_GPL(unregister_efivars); |
1960 | 1922 | ||
1923 | /* | ||
1924 | * Print a warning when duplicate EFI variables are encountered and | ||
1925 | * disable the sysfs workqueue since the firmware is buggy. | ||
1926 | */ | ||
1927 | static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid, | ||
1928 | unsigned long len16) | ||
1929 | { | ||
1930 | size_t i, len8 = len16 / sizeof(efi_char16_t); | ||
1931 | char *s8; | ||
1932 | |||
1933 | /* | ||
1934 | * Disable the workqueue since the algorithm it uses for | ||
1935 | * detecting new variables won't work with this buggy | ||
1936 | * implementation of GetNextVariableName(). | ||
1937 | */ | ||
1938 | efivar_wq_enabled = false; | ||
1939 | |||
1940 | s8 = kzalloc(len8, GFP_KERNEL); | ||
1941 | if (!s8) | ||
1942 | return; | ||
1943 | |||
1944 | for (i = 0; i < len8; i++) | ||
1945 | s8[i] = s16[i]; | ||
1946 | |||
1947 | printk(KERN_WARNING "efivars: duplicate variable: %s-%pUl\n", | ||
1948 | s8, vendor_guid); | ||
1949 | kfree(s8); | ||
1950 | } | ||
1951 | |||
1961 | int register_efivars(struct efivars *efivars, | 1952 | int register_efivars(struct efivars *efivars, |
1962 | const struct efivar_operations *ops, | 1953 | const struct efivar_operations *ops, |
1963 | struct kobject *parent_kobj) | 1954 | struct kobject *parent_kobj) |
@@ -2006,6 +1997,24 @@ int register_efivars(struct efivars *efivars, | |||
2006 | &vendor_guid); | 1997 | &vendor_guid); |
2007 | switch (status) { | 1998 | switch (status) { |
2008 | case EFI_SUCCESS: | 1999 | case EFI_SUCCESS: |
2000 | variable_name_size = var_name_strnsize(variable_name, | ||
2001 | variable_name_size); | ||
2002 | |||
2003 | /* | ||
2004 | * Some firmware implementations return the | ||
2005 | * same variable name on multiple calls to | ||
2006 | * get_next_variable(). Terminate the loop | ||
2007 | * immediately as there is no guarantee that | ||
2008 | * we'll ever see a different variable name, | ||
2009 | * and may end up looping here forever. | ||
2010 | */ | ||
2011 | if (variable_is_present(variable_name, &vendor_guid)) { | ||
2012 | dup_variable_bug(variable_name, &vendor_guid, | ||
2013 | variable_name_size); | ||
2014 | status = EFI_NOT_FOUND; | ||
2015 | break; | ||
2016 | } | ||
2017 | |||
2009 | efivar_create_sysfs_entry(efivars, | 2018 | efivar_create_sysfs_entry(efivars, |
2010 | variable_name_size, | 2019 | variable_name_size, |
2011 | variable_name, | 2020 | variable_name, |
@@ -2025,15 +2034,8 @@ int register_efivars(struct efivars *efivars, | |||
2025 | if (error) | 2034 | if (error) |
2026 | unregister_efivars(efivars); | 2035 | unregister_efivars(efivars); |
2027 | 2036 | ||
2028 | efivars->efi_pstore_info = efi_pstore_info; | 2037 | if (!efivars_pstore_disable) |
2029 | 2038 | efivar_pstore_register(efivars); | |
2030 | efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); | ||
2031 | if (efivars->efi_pstore_info.buf) { | ||
2032 | efivars->efi_pstore_info.bufsize = 1024; | ||
2033 | efivars->efi_pstore_info.data = efivars; | ||
2034 | spin_lock_init(&efivars->efi_pstore_info.buf_lock); | ||
2035 | pstore_register(&efivars->efi_pstore_info); | ||
2036 | } | ||
2037 | 2039 | ||
2038 | register_filesystem(&efivarfs_type); | 2040 | register_filesystem(&efivarfs_type); |
2039 | 2041 | ||
@@ -2073,7 +2075,7 @@ efivars_init(void) | |||
2073 | ops.get_variable = efi.get_variable; | 2075 | ops.get_variable = efi.get_variable; |
2074 | ops.set_variable = efi.set_variable; | 2076 | ops.set_variable = efi.set_variable; |
2075 | ops.get_next_variable = efi.get_next_variable; | 2077 | ops.get_next_variable = efi.get_next_variable; |
2076 | ops.query_variable_info = efi.query_variable_info; | 2078 | ops.query_variable_store = efi_query_variable_store; |
2077 | 2079 | ||
2078 | error = register_efivars(&__efivars, &ops, efi_kobj); | 2080 | error = register_efivars(&__efivars, &ops, efi_kobj); |
2079 | if (error) | 2081 | if (error) |
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c index f9dbd503fc40..de3c317bd3e2 100644 --- a/drivers/gpio/gpio-ich.c +++ b/drivers/gpio/gpio-ich.c | |||
@@ -214,7 +214,7 @@ static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr) | |||
214 | * If it can't be trusted, assume that the pin can be used as a GPIO. | 214 | * If it can't be trusted, assume that the pin can be used as a GPIO. |
215 | */ | 215 | */ |
216 | if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) | 216 | if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) |
217 | return 1; | 217 | return 0; |
218 | 218 | ||
219 | return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; | 219 | return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; |
220 | } | 220 | } |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 7472182967ce..61a6fde6c089 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/io.h> | 42 | #include <linux/io.h> |
43 | #include <linux/of_irq.h> | 43 | #include <linux/of_irq.h> |
44 | #include <linux/of_device.h> | 44 | #include <linux/of_device.h> |
45 | #include <linux/clk.h> | ||
45 | #include <linux/pinctrl/consumer.h> | 46 | #include <linux/pinctrl/consumer.h> |
46 | 47 | ||
47 | /* | 48 | /* |
@@ -496,6 +497,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | |||
496 | struct resource *res; | 497 | struct resource *res; |
497 | struct irq_chip_generic *gc; | 498 | struct irq_chip_generic *gc; |
498 | struct irq_chip_type *ct; | 499 | struct irq_chip_type *ct; |
500 | struct clk *clk; | ||
499 | unsigned int ngpios; | 501 | unsigned int ngpios; |
500 | int soc_variant; | 502 | int soc_variant; |
501 | int i, cpu, id; | 503 | int i, cpu, id; |
@@ -529,6 +531,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | |||
529 | return id; | 531 | return id; |
530 | } | 532 | } |
531 | 533 | ||
534 | clk = devm_clk_get(&pdev->dev, NULL); | ||
535 | /* Not all SoCs require a clock.*/ | ||
536 | if (!IS_ERR(clk)) | ||
537 | clk_prepare_enable(clk); | ||
538 | |||
532 | mvchip->soc_variant = soc_variant; | 539 | mvchip->soc_variant = soc_variant; |
533 | mvchip->chip.label = dev_name(&pdev->dev); | 540 | mvchip->chip.label = dev_name(&pdev->dev); |
534 | mvchip->chip.dev = &pdev->dev; | 541 | mvchip->chip.dev = &pdev->dev; |
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 24059462c87f..9391cf16e990 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
@@ -575,7 +575,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, | |||
575 | chip->gpio_chip.ngpio, | 575 | chip->gpio_chip.ngpio, |
576 | irq_base, | 576 | irq_base, |
577 | &pca953x_irq_simple_ops, | 577 | &pca953x_irq_simple_ops, |
578 | NULL); | 578 | chip); |
579 | if (!chip->domain) | 579 | if (!chip->domain) |
580 | return -ENODEV; | 580 | return -ENODEV; |
581 | 581 | ||
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 770476a9da87..3ce5bc38ac31 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c | |||
@@ -307,11 +307,15 @@ static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = { | |||
307 | .xlate = irq_domain_xlate_twocell, | 307 | .xlate = irq_domain_xlate_twocell, |
308 | }; | 308 | }; |
309 | 309 | ||
310 | static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio) | 310 | static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio, |
311 | struct device_node *np) | ||
311 | { | 312 | { |
312 | int base = stmpe_gpio->irq_base; | 313 | int base = 0; |
313 | 314 | ||
314 | stmpe_gpio->domain = irq_domain_add_simple(NULL, | 315 | if (!np) |
316 | base = stmpe_gpio->irq_base; | ||
317 | |||
318 | stmpe_gpio->domain = irq_domain_add_simple(np, | ||
315 | stmpe_gpio->chip.ngpio, base, | 319 | stmpe_gpio->chip.ngpio, base, |
316 | &stmpe_gpio_irq_simple_ops, stmpe_gpio); | 320 | &stmpe_gpio_irq_simple_ops, stmpe_gpio); |
317 | if (!stmpe_gpio->domain) { | 321 | if (!stmpe_gpio->domain) { |
@@ -346,6 +350,9 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
346 | stmpe_gpio->chip = template_chip; | 350 | stmpe_gpio->chip = template_chip; |
347 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; | 351 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; |
348 | stmpe_gpio->chip.dev = &pdev->dev; | 352 | stmpe_gpio->chip.dev = &pdev->dev; |
353 | #ifdef CONFIG_OF | ||
354 | stmpe_gpio->chip.of_node = np; | ||
355 | #endif | ||
349 | stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; | 356 | stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; |
350 | 357 | ||
351 | if (pdata) | 358 | if (pdata) |
@@ -366,7 +373,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
366 | goto out_free; | 373 | goto out_free; |
367 | 374 | ||
368 | if (irq >= 0) { | 375 | if (irq >= 0) { |
369 | ret = stmpe_gpio_irq_init(stmpe_gpio); | 376 | ret = stmpe_gpio_irq_init(stmpe_gpio, np); |
370 | if (ret) | 377 | if (ret) |
371 | goto out_disable; | 378 | goto out_disable; |
372 | 379 | ||
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a71a54a3e3f7..5150df6cba08 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -193,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) | |||
193 | if (!np) | 193 | if (!np) |
194 | return; | 194 | return; |
195 | 195 | ||
196 | do { | 196 | for (;; index++) { |
197 | ret = of_parse_phandle_with_args(np, "gpio-ranges", | 197 | ret = of_parse_phandle_with_args(np, "gpio-ranges", |
198 | "#gpio-range-cells", index, &pinspec); | 198 | "#gpio-range-cells", index, &pinspec); |
199 | if (ret) | 199 | if (ret) |
@@ -222,8 +222,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) | |||
222 | 222 | ||
223 | if (ret) | 223 | if (ret) |
224 | break; | 224 | break; |
225 | 225 | } | |
226 | } while (index++); | ||
227 | } | 226 | } |
228 | 227 | ||
229 | #else | 228 | #else |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 792c3e3795ca..dd64a06dc5b4 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2326,7 +2326,6 @@ int drm_mode_addfb(struct drm_device *dev, | |||
2326 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r); | 2326 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r); |
2327 | if (IS_ERR(fb)) { | 2327 | if (IS_ERR(fb)) { |
2328 | DRM_DEBUG_KMS("could not create framebuffer\n"); | 2328 | DRM_DEBUG_KMS("could not create framebuffer\n"); |
2329 | drm_modeset_unlock_all(dev); | ||
2330 | return PTR_ERR(fb); | 2329 | return PTR_ERR(fb); |
2331 | } | 2330 | } |
2332 | 2331 | ||
@@ -2506,7 +2505,6 @@ int drm_mode_addfb2(struct drm_device *dev, | |||
2506 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); | 2505 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); |
2507 | if (IS_ERR(fb)) { | 2506 | if (IS_ERR(fb)) { |
2508 | DRM_DEBUG_KMS("could not create framebuffer\n"); | 2507 | DRM_DEBUG_KMS("could not create framebuffer\n"); |
2509 | drm_modeset_unlock_all(dev); | ||
2510 | return PTR_ERR(fb); | 2508 | return PTR_ERR(fb); |
2511 | } | 2509 | } |
2512 | 2510 | ||
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c194f4e680ad..e2acfdbf7d3c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1634,7 +1634,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
1634 | unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; | 1634 | unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; |
1635 | unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; | 1635 | unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; |
1636 | unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; | 1636 | unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; |
1637 | unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; | 1637 | unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4; |
1638 | unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); | 1638 | unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); |
1639 | 1639 | ||
1640 | /* ignore tiny modes */ | 1640 | /* ignore tiny modes */ |
@@ -1715,6 +1715,7 @@ set_size: | |||
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | mode->type = DRM_MODE_TYPE_DRIVER; | 1717 | mode->type = DRM_MODE_TYPE_DRIVER; |
1718 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
1718 | drm_mode_set_name(mode); | 1719 | drm_mode_set_name(mode); |
1719 | 1720 | ||
1720 | return mode; | 1721 | return mode; |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 59d6b9bf204b..892ff9f95975 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -1544,10 +1544,10 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) | |||
1544 | if (!fb_helper->fb) | 1544 | if (!fb_helper->fb) |
1545 | return 0; | 1545 | return 0; |
1546 | 1546 | ||
1547 | drm_modeset_lock_all(dev); | 1547 | mutex_lock(&fb_helper->dev->mode_config.mutex); |
1548 | if (!drm_fb_helper_is_bound(fb_helper)) { | 1548 | if (!drm_fb_helper_is_bound(fb_helper)) { |
1549 | fb_helper->delayed_hotplug = true; | 1549 | fb_helper->delayed_hotplug = true; |
1550 | drm_modeset_unlock_all(dev); | 1550 | mutex_unlock(&fb_helper->dev->mode_config.mutex); |
1551 | return 0; | 1551 | return 0; |
1552 | } | 1552 | } |
1553 | DRM_DEBUG_KMS("\n"); | 1553 | DRM_DEBUG_KMS("\n"); |
@@ -1558,9 +1558,11 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) | |||
1558 | 1558 | ||
1559 | count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, | 1559 | count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, |
1560 | max_height); | 1560 | max_height); |
1561 | mutex_unlock(&fb_helper->dev->mode_config.mutex); | ||
1562 | |||
1563 | drm_modeset_lock_all(dev); | ||
1561 | drm_setup_crtcs(fb_helper); | 1564 | drm_setup_crtcs(fb_helper); |
1562 | drm_modeset_unlock_all(dev); | 1565 | drm_modeset_unlock_all(dev); |
1563 | |||
1564 | drm_fb_helper_set_par(fb_helper->fbdev); | 1566 | drm_fb_helper_set_par(fb_helper->fbdev); |
1565 | 1567 | ||
1566 | return 0; | 1568 | return 0; |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 13fdcd10a605..429e07d0b0f1 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -123,6 +123,7 @@ int drm_open(struct inode *inode, struct file *filp) | |||
123 | int retcode = 0; | 123 | int retcode = 0; |
124 | int need_setup = 0; | 124 | int need_setup = 0; |
125 | struct address_space *old_mapping; | 125 | struct address_space *old_mapping; |
126 | struct address_space *old_imapping; | ||
126 | 127 | ||
127 | minor = idr_find(&drm_minors_idr, minor_id); | 128 | minor = idr_find(&drm_minors_idr, minor_id); |
128 | if (!minor) | 129 | if (!minor) |
@@ -137,6 +138,7 @@ int drm_open(struct inode *inode, struct file *filp) | |||
137 | if (!dev->open_count++) | 138 | if (!dev->open_count++) |
138 | need_setup = 1; | 139 | need_setup = 1; |
139 | mutex_lock(&dev->struct_mutex); | 140 | mutex_lock(&dev->struct_mutex); |
141 | old_imapping = inode->i_mapping; | ||
140 | old_mapping = dev->dev_mapping; | 142 | old_mapping = dev->dev_mapping; |
141 | if (old_mapping == NULL) | 143 | if (old_mapping == NULL) |
142 | dev->dev_mapping = &inode->i_data; | 144 | dev->dev_mapping = &inode->i_data; |
@@ -159,8 +161,8 @@ int drm_open(struct inode *inode, struct file *filp) | |||
159 | 161 | ||
160 | err_undo: | 162 | err_undo: |
161 | mutex_lock(&dev->struct_mutex); | 163 | mutex_lock(&dev->struct_mutex); |
162 | filp->f_mapping = old_mapping; | 164 | filp->f_mapping = old_imapping; |
163 | inode->i_mapping = old_mapping; | 165 | inode->i_mapping = old_imapping; |
164 | iput(container_of(dev->dev_mapping, struct inode, i_data)); | 166 | iput(container_of(dev->dev_mapping, struct inode, i_data)); |
165 | dev->dev_mapping = old_mapping; | 167 | dev->dev_mapping = old_mapping; |
166 | mutex_unlock(&dev->struct_mutex); | 168 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 36493ce71f9a..98cc14725ba9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -38,11 +38,12 @@ | |||
38 | /* position control register for hardware window 0, 2 ~ 4.*/ | 38 | /* position control register for hardware window 0, 2 ~ 4.*/ |
39 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) | 39 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) |
40 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) | 40 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) |
41 | /* size control register for hardware window 0. */ | 41 | /* |
42 | #define VIDOSD_C_SIZE_W0 (VIDOSD_BASE + 0x08) | 42 | * size control register for hardware windows 0 and alpha control register |
43 | /* alpha control register for hardware window 1 ~ 4. */ | 43 | * for hardware windows 1 ~ 4 |
44 | #define VIDOSD_C(win) (VIDOSD_BASE + 0x18 + (win) * 16) | 44 | */ |
45 | /* size control register for hardware window 1 ~ 4. */ | 45 | #define VIDOSD_C(win) (VIDOSD_BASE + 0x08 + (win) * 16) |
46 | /* size control register for hardware windows 1 ~ 2. */ | ||
46 | #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16) | 47 | #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16) |
47 | 48 | ||
48 | #define VIDWx_BUF_START(win, buf) (VIDW_BUF_START(buf) + (win) * 8) | 49 | #define VIDWx_BUF_START(win, buf) (VIDW_BUF_START(buf) + (win) * 8) |
@@ -50,9 +51,9 @@ | |||
50 | #define VIDWx_BUF_SIZE(win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4) | 51 | #define VIDWx_BUF_SIZE(win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4) |
51 | 52 | ||
52 | /* color key control register for hardware window 1 ~ 4. */ | 53 | /* color key control register for hardware window 1 ~ 4. */ |
53 | #define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + (x * 8)) | 54 | #define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + ((x - 1) * 8)) |
54 | /* color key value register for hardware window 1 ~ 4. */ | 55 | /* color key value register for hardware window 1 ~ 4. */ |
55 | #define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + (x * 8)) | 56 | #define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + ((x - 1) * 8)) |
56 | 57 | ||
57 | /* FIMD has totally five hardware windows. */ | 58 | /* FIMD has totally five hardware windows. */ |
58 | #define WINDOWS_NR 5 | 59 | #define WINDOWS_NR 5 |
@@ -109,9 +110,9 @@ struct fimd_context { | |||
109 | 110 | ||
110 | #ifdef CONFIG_OF | 111 | #ifdef CONFIG_OF |
111 | static const struct of_device_id fimd_driver_dt_match[] = { | 112 | static const struct of_device_id fimd_driver_dt_match[] = { |
112 | { .compatible = "samsung,exynos4-fimd", | 113 | { .compatible = "samsung,exynos4210-fimd", |
113 | .data = &exynos4_fimd_driver_data }, | 114 | .data = &exynos4_fimd_driver_data }, |
114 | { .compatible = "samsung,exynos5-fimd", | 115 | { .compatible = "samsung,exynos5250-fimd", |
115 | .data = &exynos5_fimd_driver_data }, | 116 | .data = &exynos5_fimd_driver_data }, |
116 | {}, | 117 | {}, |
117 | }; | 118 | }; |
@@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos) | |||
581 | if (win != 3 && win != 4) { | 582 | if (win != 3 && win != 4) { |
582 | u32 offset = VIDOSD_D(win); | 583 | u32 offset = VIDOSD_D(win); |
583 | if (win == 0) | 584 | if (win == 0) |
584 | offset = VIDOSD_C_SIZE_W0; | 585 | offset = VIDOSD_C(win); |
585 | val = win_data->ovl_width * win_data->ovl_height; | 586 | val = win_data->ovl_width * win_data->ovl_height; |
586 | writel(val, ctx->regs + offset); | 587 | writel(val, ctx->regs + offset); |
587 | 588 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 3b0da0378acf..47a493c8a71f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -48,8 +48,14 @@ | |||
48 | 48 | ||
49 | /* registers for base address */ | 49 | /* registers for base address */ |
50 | #define G2D_SRC_BASE_ADDR 0x0304 | 50 | #define G2D_SRC_BASE_ADDR 0x0304 |
51 | #define G2D_SRC_COLOR_MODE 0x030C | ||
52 | #define G2D_SRC_LEFT_TOP 0x0310 | ||
53 | #define G2D_SRC_RIGHT_BOTTOM 0x0314 | ||
51 | #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 | 54 | #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 |
52 | #define G2D_DST_BASE_ADDR 0x0404 | 55 | #define G2D_DST_BASE_ADDR 0x0404 |
56 | #define G2D_DST_COLOR_MODE 0x040C | ||
57 | #define G2D_DST_LEFT_TOP 0x0410 | ||
58 | #define G2D_DST_RIGHT_BOTTOM 0x0414 | ||
53 | #define G2D_DST_PLANE2_BASE_ADDR 0x0418 | 59 | #define G2D_DST_PLANE2_BASE_ADDR 0x0418 |
54 | #define G2D_PAT_BASE_ADDR 0x0500 | 60 | #define G2D_PAT_BASE_ADDR 0x0500 |
55 | #define G2D_MSK_BASE_ADDR 0x0520 | 61 | #define G2D_MSK_BASE_ADDR 0x0520 |
@@ -82,7 +88,7 @@ | |||
82 | #define G2D_DMA_LIST_DONE_COUNT_OFFSET 17 | 88 | #define G2D_DMA_LIST_DONE_COUNT_OFFSET 17 |
83 | 89 | ||
84 | /* G2D_DMA_HOLD_CMD */ | 90 | /* G2D_DMA_HOLD_CMD */ |
85 | #define G2D_USET_HOLD (1 << 2) | 91 | #define G2D_USER_HOLD (1 << 2) |
86 | #define G2D_LIST_HOLD (1 << 1) | 92 | #define G2D_LIST_HOLD (1 << 1) |
87 | #define G2D_BITBLT_HOLD (1 << 0) | 93 | #define G2D_BITBLT_HOLD (1 << 0) |
88 | 94 | ||
@@ -91,13 +97,27 @@ | |||
91 | #define G2D_START_NHOLT (1 << 1) | 97 | #define G2D_START_NHOLT (1 << 1) |
92 | #define G2D_START_BITBLT (1 << 0) | 98 | #define G2D_START_BITBLT (1 << 0) |
93 | 99 | ||
100 | /* buffer color format */ | ||
101 | #define G2D_FMT_XRGB8888 0 | ||
102 | #define G2D_FMT_ARGB8888 1 | ||
103 | #define G2D_FMT_RGB565 2 | ||
104 | #define G2D_FMT_XRGB1555 3 | ||
105 | #define G2D_FMT_ARGB1555 4 | ||
106 | #define G2D_FMT_XRGB4444 5 | ||
107 | #define G2D_FMT_ARGB4444 6 | ||
108 | #define G2D_FMT_PACKED_RGB888 7 | ||
109 | #define G2D_FMT_A8 11 | ||
110 | #define G2D_FMT_L8 12 | ||
111 | |||
112 | /* buffer valid length */ | ||
113 | #define G2D_LEN_MIN 1 | ||
114 | #define G2D_LEN_MAX 8000 | ||
115 | |||
94 | #define G2D_CMDLIST_SIZE (PAGE_SIZE / 4) | 116 | #define G2D_CMDLIST_SIZE (PAGE_SIZE / 4) |
95 | #define G2D_CMDLIST_NUM 64 | 117 | #define G2D_CMDLIST_NUM 64 |
96 | #define G2D_CMDLIST_POOL_SIZE (G2D_CMDLIST_SIZE * G2D_CMDLIST_NUM) | 118 | #define G2D_CMDLIST_POOL_SIZE (G2D_CMDLIST_SIZE * G2D_CMDLIST_NUM) |
97 | #define G2D_CMDLIST_DATA_NUM (G2D_CMDLIST_SIZE / sizeof(u32) - 2) | 119 | #define G2D_CMDLIST_DATA_NUM (G2D_CMDLIST_SIZE / sizeof(u32) - 2) |
98 | 120 | ||
99 | #define MAX_BUF_ADDR_NR 6 | ||
100 | |||
101 | /* maximum buffer pool size of userptr is 64MB as default */ | 121 | /* maximum buffer pool size of userptr is 64MB as default */ |
102 | #define MAX_POOL (64 * 1024 * 1024) | 122 | #define MAX_POOL (64 * 1024 * 1024) |
103 | 123 | ||
@@ -106,6 +126,17 @@ enum { | |||
106 | BUF_TYPE_USERPTR, | 126 | BUF_TYPE_USERPTR, |
107 | }; | 127 | }; |
108 | 128 | ||
129 | enum g2d_reg_type { | ||
130 | REG_TYPE_NONE = -1, | ||
131 | REG_TYPE_SRC, | ||
132 | REG_TYPE_SRC_PLANE2, | ||
133 | REG_TYPE_DST, | ||
134 | REG_TYPE_DST_PLANE2, | ||
135 | REG_TYPE_PAT, | ||
136 | REG_TYPE_MSK, | ||
137 | MAX_REG_TYPE_NR | ||
138 | }; | ||
139 | |||
109 | /* cmdlist data structure */ | 140 | /* cmdlist data structure */ |
110 | struct g2d_cmdlist { | 141 | struct g2d_cmdlist { |
111 | u32 head; | 142 | u32 head; |
@@ -113,6 +144,42 @@ struct g2d_cmdlist { | |||
113 | u32 last; /* last data offset */ | 144 | u32 last; /* last data offset */ |
114 | }; | 145 | }; |
115 | 146 | ||
147 | /* | ||
148 | * A structure of buffer description | ||
149 | * | ||
150 | * @format: color format | ||
151 | * @left_x: the x coordinates of left top corner | ||
152 | * @top_y: the y coordinates of left top corner | ||
153 | * @right_x: the x coordinates of right bottom corner | ||
154 | * @bottom_y: the y coordinates of right bottom corner | ||
155 | * | ||
156 | */ | ||
157 | struct g2d_buf_desc { | ||
158 | unsigned int format; | ||
159 | unsigned int left_x; | ||
160 | unsigned int top_y; | ||
161 | unsigned int right_x; | ||
162 | unsigned int bottom_y; | ||
163 | }; | ||
164 | |||
165 | /* | ||
166 | * A structure of buffer information | ||
167 | * | ||
168 | * @map_nr: manages the number of mapped buffers | ||
169 | * @reg_types: stores regitster type in the order of requested command | ||
170 | * @handles: stores buffer handle in its reg_type position | ||
171 | * @types: stores buffer type in its reg_type position | ||
172 | * @descs: stores buffer description in its reg_type position | ||
173 | * | ||
174 | */ | ||
175 | struct g2d_buf_info { | ||
176 | unsigned int map_nr; | ||
177 | enum g2d_reg_type reg_types[MAX_REG_TYPE_NR]; | ||
178 | unsigned long handles[MAX_REG_TYPE_NR]; | ||
179 | unsigned int types[MAX_REG_TYPE_NR]; | ||
180 | struct g2d_buf_desc descs[MAX_REG_TYPE_NR]; | ||
181 | }; | ||
182 | |||
116 | struct drm_exynos_pending_g2d_event { | 183 | struct drm_exynos_pending_g2d_event { |
117 | struct drm_pending_event base; | 184 | struct drm_pending_event base; |
118 | struct drm_exynos_g2d_event event; | 185 | struct drm_exynos_g2d_event event; |
@@ -131,14 +198,11 @@ struct g2d_cmdlist_userptr { | |||
131 | bool in_pool; | 198 | bool in_pool; |
132 | bool out_of_list; | 199 | bool out_of_list; |
133 | }; | 200 | }; |
134 | |||
135 | struct g2d_cmdlist_node { | 201 | struct g2d_cmdlist_node { |
136 | struct list_head list; | 202 | struct list_head list; |
137 | struct g2d_cmdlist *cmdlist; | 203 | struct g2d_cmdlist *cmdlist; |
138 | unsigned int map_nr; | ||
139 | unsigned long handles[MAX_BUF_ADDR_NR]; | ||
140 | unsigned int obj_type[MAX_BUF_ADDR_NR]; | ||
141 | dma_addr_t dma_addr; | 204 | dma_addr_t dma_addr; |
205 | struct g2d_buf_info buf_info; | ||
142 | 206 | ||
143 | struct drm_exynos_pending_g2d_event *event; | 207 | struct drm_exynos_pending_g2d_event *event; |
144 | }; | 208 | }; |
@@ -188,6 +252,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) | |||
188 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; | 252 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; |
189 | int nr; | 253 | int nr; |
190 | int ret; | 254 | int ret; |
255 | struct g2d_buf_info *buf_info; | ||
191 | 256 | ||
192 | init_dma_attrs(&g2d->cmdlist_dma_attrs); | 257 | init_dma_attrs(&g2d->cmdlist_dma_attrs); |
193 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &g2d->cmdlist_dma_attrs); | 258 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &g2d->cmdlist_dma_attrs); |
@@ -209,11 +274,17 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) | |||
209 | } | 274 | } |
210 | 275 | ||
211 | for (nr = 0; nr < G2D_CMDLIST_NUM; nr++) { | 276 | for (nr = 0; nr < G2D_CMDLIST_NUM; nr++) { |
277 | unsigned int i; | ||
278 | |||
212 | node[nr].cmdlist = | 279 | node[nr].cmdlist = |
213 | g2d->cmdlist_pool_virt + nr * G2D_CMDLIST_SIZE; | 280 | g2d->cmdlist_pool_virt + nr * G2D_CMDLIST_SIZE; |
214 | node[nr].dma_addr = | 281 | node[nr].dma_addr = |
215 | g2d->cmdlist_pool + nr * G2D_CMDLIST_SIZE; | 282 | g2d->cmdlist_pool + nr * G2D_CMDLIST_SIZE; |
216 | 283 | ||
284 | buf_info = &node[nr].buf_info; | ||
285 | for (i = 0; i < MAX_REG_TYPE_NR; i++) | ||
286 | buf_info->reg_types[i] = REG_TYPE_NONE; | ||
287 | |||
217 | list_add_tail(&node[nr].list, &g2d->free_cmdlist); | 288 | list_add_tail(&node[nr].list, &g2d->free_cmdlist); |
218 | } | 289 | } |
219 | 290 | ||
@@ -450,7 +521,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
450 | DMA_BIDIRECTIONAL); | 521 | DMA_BIDIRECTIONAL); |
451 | if (ret < 0) { | 522 | if (ret < 0) { |
452 | DRM_ERROR("failed to map sgt with dma region.\n"); | 523 | DRM_ERROR("failed to map sgt with dma region.\n"); |
453 | goto err_free_sgt; | 524 | goto err_sg_free_table; |
454 | } | 525 | } |
455 | 526 | ||
456 | g2d_userptr->dma_addr = sgt->sgl[0].dma_address; | 527 | g2d_userptr->dma_addr = sgt->sgl[0].dma_address; |
@@ -467,8 +538,10 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
467 | 538 | ||
468 | return &g2d_userptr->dma_addr; | 539 | return &g2d_userptr->dma_addr; |
469 | 540 | ||
470 | err_free_sgt: | 541 | err_sg_free_table: |
471 | sg_free_table(sgt); | 542 | sg_free_table(sgt); |
543 | |||
544 | err_free_sgt: | ||
472 | kfree(sgt); | 545 | kfree(sgt); |
473 | sgt = NULL; | 546 | sgt = NULL; |
474 | 547 | ||
@@ -506,36 +579,172 @@ static void g2d_userptr_free_all(struct drm_device *drm_dev, | |||
506 | g2d->current_pool = 0; | 579 | g2d->current_pool = 0; |
507 | } | 580 | } |
508 | 581 | ||
582 | static enum g2d_reg_type g2d_get_reg_type(int reg_offset) | ||
583 | { | ||
584 | enum g2d_reg_type reg_type; | ||
585 | |||
586 | switch (reg_offset) { | ||
587 | case G2D_SRC_BASE_ADDR: | ||
588 | case G2D_SRC_COLOR_MODE: | ||
589 | case G2D_SRC_LEFT_TOP: | ||
590 | case G2D_SRC_RIGHT_BOTTOM: | ||
591 | reg_type = REG_TYPE_SRC; | ||
592 | break; | ||
593 | case G2D_SRC_PLANE2_BASE_ADDR: | ||
594 | reg_type = REG_TYPE_SRC_PLANE2; | ||
595 | break; | ||
596 | case G2D_DST_BASE_ADDR: | ||
597 | case G2D_DST_COLOR_MODE: | ||
598 | case G2D_DST_LEFT_TOP: | ||
599 | case G2D_DST_RIGHT_BOTTOM: | ||
600 | reg_type = REG_TYPE_DST; | ||
601 | break; | ||
602 | case G2D_DST_PLANE2_BASE_ADDR: | ||
603 | reg_type = REG_TYPE_DST_PLANE2; | ||
604 | break; | ||
605 | case G2D_PAT_BASE_ADDR: | ||
606 | reg_type = REG_TYPE_PAT; | ||
607 | break; | ||
608 | case G2D_MSK_BASE_ADDR: | ||
609 | reg_type = REG_TYPE_MSK; | ||
610 | break; | ||
611 | default: | ||
612 | reg_type = REG_TYPE_NONE; | ||
613 | DRM_ERROR("Unknown register offset![%d]\n", reg_offset); | ||
614 | break; | ||
615 | }; | ||
616 | |||
617 | return reg_type; | ||
618 | } | ||
619 | |||
620 | static unsigned long g2d_get_buf_bpp(unsigned int format) | ||
621 | { | ||
622 | unsigned long bpp; | ||
623 | |||
624 | switch (format) { | ||
625 | case G2D_FMT_XRGB8888: | ||
626 | case G2D_FMT_ARGB8888: | ||
627 | bpp = 4; | ||
628 | break; | ||
629 | case G2D_FMT_RGB565: | ||
630 | case G2D_FMT_XRGB1555: | ||
631 | case G2D_FMT_ARGB1555: | ||
632 | case G2D_FMT_XRGB4444: | ||
633 | case G2D_FMT_ARGB4444: | ||
634 | bpp = 2; | ||
635 | break; | ||
636 | case G2D_FMT_PACKED_RGB888: | ||
637 | bpp = 3; | ||
638 | break; | ||
639 | default: | ||
640 | bpp = 1; | ||
641 | break; | ||
642 | } | ||
643 | |||
644 | return bpp; | ||
645 | } | ||
646 | |||
647 | static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc, | ||
648 | enum g2d_reg_type reg_type, | ||
649 | unsigned long size) | ||
650 | { | ||
651 | unsigned int width, height; | ||
652 | unsigned long area; | ||
653 | |||
654 | /* | ||
655 | * check source and destination buffers only. | ||
656 | * so the others are always valid. | ||
657 | */ | ||
658 | if (reg_type != REG_TYPE_SRC && reg_type != REG_TYPE_DST) | ||
659 | return true; | ||
660 | |||
661 | width = buf_desc->right_x - buf_desc->left_x; | ||
662 | if (width < G2D_LEN_MIN || width > G2D_LEN_MAX) { | ||
663 | DRM_ERROR("width[%u] is out of range!\n", width); | ||
664 | return false; | ||
665 | } | ||
666 | |||
667 | height = buf_desc->bottom_y - buf_desc->top_y; | ||
668 | if (height < G2D_LEN_MIN || height > G2D_LEN_MAX) { | ||
669 | DRM_ERROR("height[%u] is out of range!\n", height); | ||
670 | return false; | ||
671 | } | ||
672 | |||
673 | area = (unsigned long)width * (unsigned long)height * | ||
674 | g2d_get_buf_bpp(buf_desc->format); | ||
675 | if (area > size) { | ||
676 | DRM_ERROR("area[%lu] is out of range[%lu]!\n", area, size); | ||
677 | return false; | ||
678 | } | ||
679 | |||
680 | return true; | ||
681 | } | ||
682 | |||
509 | static int g2d_map_cmdlist_gem(struct g2d_data *g2d, | 683 | static int g2d_map_cmdlist_gem(struct g2d_data *g2d, |
510 | struct g2d_cmdlist_node *node, | 684 | struct g2d_cmdlist_node *node, |
511 | struct drm_device *drm_dev, | 685 | struct drm_device *drm_dev, |
512 | struct drm_file *file) | 686 | struct drm_file *file) |
513 | { | 687 | { |
514 | struct g2d_cmdlist *cmdlist = node->cmdlist; | 688 | struct g2d_cmdlist *cmdlist = node->cmdlist; |
689 | struct g2d_buf_info *buf_info = &node->buf_info; | ||
515 | int offset; | 690 | int offset; |
691 | int ret; | ||
516 | int i; | 692 | int i; |
517 | 693 | ||
518 | for (i = 0; i < node->map_nr; i++) { | 694 | for (i = 0; i < buf_info->map_nr; i++) { |
695 | struct g2d_buf_desc *buf_desc; | ||
696 | enum g2d_reg_type reg_type; | ||
697 | int reg_pos; | ||
519 | unsigned long handle; | 698 | unsigned long handle; |
520 | dma_addr_t *addr; | 699 | dma_addr_t *addr; |
521 | 700 | ||
522 | offset = cmdlist->last - (i * 2 + 1); | 701 | reg_pos = cmdlist->last - 2 * (i + 1); |
523 | handle = cmdlist->data[offset]; | 702 | |
703 | offset = cmdlist->data[reg_pos]; | ||
704 | handle = cmdlist->data[reg_pos + 1]; | ||
705 | |||
706 | reg_type = g2d_get_reg_type(offset); | ||
707 | if (reg_type == REG_TYPE_NONE) { | ||
708 | ret = -EFAULT; | ||
709 | goto err; | ||
710 | } | ||
711 | |||
712 | buf_desc = &buf_info->descs[reg_type]; | ||
713 | |||
714 | if (buf_info->types[reg_type] == BUF_TYPE_GEM) { | ||
715 | unsigned long size; | ||
716 | |||
717 | size = exynos_drm_gem_get_size(drm_dev, handle, file); | ||
718 | if (!size) { | ||
719 | ret = -EFAULT; | ||
720 | goto err; | ||
721 | } | ||
722 | |||
723 | if (!g2d_check_buf_desc_is_valid(buf_desc, reg_type, | ||
724 | size)) { | ||
725 | ret = -EFAULT; | ||
726 | goto err; | ||
727 | } | ||
524 | 728 | ||
525 | if (node->obj_type[i] == BUF_TYPE_GEM) { | ||
526 | addr = exynos_drm_gem_get_dma_addr(drm_dev, handle, | 729 | addr = exynos_drm_gem_get_dma_addr(drm_dev, handle, |
527 | file); | 730 | file); |
528 | if (IS_ERR(addr)) { | 731 | if (IS_ERR(addr)) { |
529 | node->map_nr = i; | 732 | ret = -EFAULT; |
530 | return -EFAULT; | 733 | goto err; |
531 | } | 734 | } |
532 | } else { | 735 | } else { |
533 | struct drm_exynos_g2d_userptr g2d_userptr; | 736 | struct drm_exynos_g2d_userptr g2d_userptr; |
534 | 737 | ||
535 | if (copy_from_user(&g2d_userptr, (void __user *)handle, | 738 | if (copy_from_user(&g2d_userptr, (void __user *)handle, |
536 | sizeof(struct drm_exynos_g2d_userptr))) { | 739 | sizeof(struct drm_exynos_g2d_userptr))) { |
537 | node->map_nr = i; | 740 | ret = -EFAULT; |
538 | return -EFAULT; | 741 | goto err; |
742 | } | ||
743 | |||
744 | if (!g2d_check_buf_desc_is_valid(buf_desc, reg_type, | ||
745 | g2d_userptr.size)) { | ||
746 | ret = -EFAULT; | ||
747 | goto err; | ||
539 | } | 748 | } |
540 | 749 | ||
541 | addr = g2d_userptr_get_dma_addr(drm_dev, | 750 | addr = g2d_userptr_get_dma_addr(drm_dev, |
@@ -544,16 +753,21 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, | |||
544 | file, | 753 | file, |
545 | &handle); | 754 | &handle); |
546 | if (IS_ERR(addr)) { | 755 | if (IS_ERR(addr)) { |
547 | node->map_nr = i; | 756 | ret = -EFAULT; |
548 | return -EFAULT; | 757 | goto err; |
549 | } | 758 | } |
550 | } | 759 | } |
551 | 760 | ||
552 | cmdlist->data[offset] = *addr; | 761 | cmdlist->data[reg_pos + 1] = *addr; |
553 | node->handles[i] = handle; | 762 | buf_info->reg_types[i] = reg_type; |
763 | buf_info->handles[reg_type] = handle; | ||
554 | } | 764 | } |
555 | 765 | ||
556 | return 0; | 766 | return 0; |
767 | |||
768 | err: | ||
769 | buf_info->map_nr = i; | ||
770 | return ret; | ||
557 | } | 771 | } |
558 | 772 | ||
559 | static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, | 773 | static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, |
@@ -561,22 +775,33 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, | |||
561 | struct drm_file *filp) | 775 | struct drm_file *filp) |
562 | { | 776 | { |
563 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; | 777 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; |
778 | struct g2d_buf_info *buf_info = &node->buf_info; | ||
564 | int i; | 779 | int i; |
565 | 780 | ||
566 | for (i = 0; i < node->map_nr; i++) { | 781 | for (i = 0; i < buf_info->map_nr; i++) { |
567 | unsigned long handle = node->handles[i]; | 782 | struct g2d_buf_desc *buf_desc; |
783 | enum g2d_reg_type reg_type; | ||
784 | unsigned long handle; | ||
785 | |||
786 | reg_type = buf_info->reg_types[i]; | ||
787 | |||
788 | buf_desc = &buf_info->descs[reg_type]; | ||
789 | handle = buf_info->handles[reg_type]; | ||
568 | 790 | ||
569 | if (node->obj_type[i] == BUF_TYPE_GEM) | 791 | if (buf_info->types[reg_type] == BUF_TYPE_GEM) |
570 | exynos_drm_gem_put_dma_addr(subdrv->drm_dev, handle, | 792 | exynos_drm_gem_put_dma_addr(subdrv->drm_dev, handle, |
571 | filp); | 793 | filp); |
572 | else | 794 | else |
573 | g2d_userptr_put_dma_addr(subdrv->drm_dev, handle, | 795 | g2d_userptr_put_dma_addr(subdrv->drm_dev, handle, |
574 | false); | 796 | false); |
575 | 797 | ||
576 | node->handles[i] = 0; | 798 | buf_info->reg_types[i] = REG_TYPE_NONE; |
799 | buf_info->handles[reg_type] = 0; | ||
800 | buf_info->types[reg_type] = 0; | ||
801 | memset(buf_desc, 0x00, sizeof(*buf_desc)); | ||
577 | } | 802 | } |
578 | 803 | ||
579 | node->map_nr = 0; | 804 | buf_info->map_nr = 0; |
580 | } | 805 | } |
581 | 806 | ||
582 | static void g2d_dma_start(struct g2d_data *g2d, | 807 | static void g2d_dma_start(struct g2d_data *g2d, |
@@ -589,10 +814,6 @@ static void g2d_dma_start(struct g2d_data *g2d, | |||
589 | pm_runtime_get_sync(g2d->dev); | 814 | pm_runtime_get_sync(g2d->dev); |
590 | clk_enable(g2d->gate_clk); | 815 | clk_enable(g2d->gate_clk); |
591 | 816 | ||
592 | /* interrupt enable */ | ||
593 | writel_relaxed(G2D_INTEN_ACF | G2D_INTEN_UCF | G2D_INTEN_GCF, | ||
594 | g2d->regs + G2D_INTEN); | ||
595 | |||
596 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); | 817 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); |
597 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); | 818 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); |
598 | } | 819 | } |
@@ -643,7 +864,6 @@ static void g2d_runqueue_worker(struct work_struct *work) | |||
643 | struct g2d_data *g2d = container_of(work, struct g2d_data, | 864 | struct g2d_data *g2d = container_of(work, struct g2d_data, |
644 | runqueue_work); | 865 | runqueue_work); |
645 | 866 | ||
646 | |||
647 | mutex_lock(&g2d->runqueue_mutex); | 867 | mutex_lock(&g2d->runqueue_mutex); |
648 | clk_disable(g2d->gate_clk); | 868 | clk_disable(g2d->gate_clk); |
649 | pm_runtime_put_sync(g2d->dev); | 869 | pm_runtime_put_sync(g2d->dev); |
@@ -724,20 +944,14 @@ static int g2d_check_reg_offset(struct device *dev, | |||
724 | int i; | 944 | int i; |
725 | 945 | ||
726 | for (i = 0; i < nr; i++) { | 946 | for (i = 0; i < nr; i++) { |
727 | index = cmdlist->last - 2 * (i + 1); | 947 | struct g2d_buf_info *buf_info = &node->buf_info; |
948 | struct g2d_buf_desc *buf_desc; | ||
949 | enum g2d_reg_type reg_type; | ||
950 | unsigned long value; | ||
728 | 951 | ||
729 | if (for_addr) { | 952 | index = cmdlist->last - 2 * (i + 1); |
730 | /* check userptr buffer type. */ | ||
731 | reg_offset = (cmdlist->data[index] & | ||
732 | ~0x7fffffff) >> 31; | ||
733 | if (reg_offset) { | ||
734 | node->obj_type[i] = BUF_TYPE_USERPTR; | ||
735 | cmdlist->data[index] &= ~G2D_BUF_USERPTR; | ||
736 | } | ||
737 | } | ||
738 | 953 | ||
739 | reg_offset = cmdlist->data[index] & ~0xfffff000; | 954 | reg_offset = cmdlist->data[index] & ~0xfffff000; |
740 | |||
741 | if (reg_offset < G2D_VALID_START || reg_offset > G2D_VALID_END) | 955 | if (reg_offset < G2D_VALID_START || reg_offset > G2D_VALID_END) |
742 | goto err; | 956 | goto err; |
743 | if (reg_offset % 4) | 957 | if (reg_offset % 4) |
@@ -753,8 +967,60 @@ static int g2d_check_reg_offset(struct device *dev, | |||
753 | if (!for_addr) | 967 | if (!for_addr) |
754 | goto err; | 968 | goto err; |
755 | 969 | ||
756 | if (node->obj_type[i] != BUF_TYPE_USERPTR) | 970 | reg_type = g2d_get_reg_type(reg_offset); |
757 | node->obj_type[i] = BUF_TYPE_GEM; | 971 | if (reg_type == REG_TYPE_NONE) |
972 | goto err; | ||
973 | |||
974 | /* check userptr buffer type. */ | ||
975 | if ((cmdlist->data[index] & ~0x7fffffff) >> 31) { | ||
976 | buf_info->types[reg_type] = BUF_TYPE_USERPTR; | ||
977 | cmdlist->data[index] &= ~G2D_BUF_USERPTR; | ||
978 | } else | ||
979 | buf_info->types[reg_type] = BUF_TYPE_GEM; | ||
980 | break; | ||
981 | case G2D_SRC_COLOR_MODE: | ||
982 | case G2D_DST_COLOR_MODE: | ||
983 | if (for_addr) | ||
984 | goto err; | ||
985 | |||
986 | reg_type = g2d_get_reg_type(reg_offset); | ||
987 | if (reg_type == REG_TYPE_NONE) | ||
988 | goto err; | ||
989 | |||
990 | buf_desc = &buf_info->descs[reg_type]; | ||
991 | value = cmdlist->data[index + 1]; | ||
992 | |||
993 | buf_desc->format = value & 0xf; | ||
994 | break; | ||
995 | case G2D_SRC_LEFT_TOP: | ||
996 | case G2D_DST_LEFT_TOP: | ||
997 | if (for_addr) | ||
998 | goto err; | ||
999 | |||
1000 | reg_type = g2d_get_reg_type(reg_offset); | ||
1001 | if (reg_type == REG_TYPE_NONE) | ||
1002 | goto err; | ||
1003 | |||
1004 | buf_desc = &buf_info->descs[reg_type]; | ||
1005 | value = cmdlist->data[index + 1]; | ||
1006 | |||
1007 | buf_desc->left_x = value & 0x1fff; | ||
1008 | buf_desc->top_y = (value & 0x1fff0000) >> 16; | ||
1009 | break; | ||
1010 | case G2D_SRC_RIGHT_BOTTOM: | ||
1011 | case G2D_DST_RIGHT_BOTTOM: | ||
1012 | if (for_addr) | ||
1013 | goto err; | ||
1014 | |||
1015 | reg_type = g2d_get_reg_type(reg_offset); | ||
1016 | if (reg_type == REG_TYPE_NONE) | ||
1017 | goto err; | ||
1018 | |||
1019 | buf_desc = &buf_info->descs[reg_type]; | ||
1020 | value = cmdlist->data[index + 1]; | ||
1021 | |||
1022 | buf_desc->right_x = value & 0x1fff; | ||
1023 | buf_desc->bottom_y = (value & 0x1fff0000) >> 16; | ||
758 | break; | 1024 | break; |
759 | default: | 1025 | default: |
760 | if (for_addr) | 1026 | if (for_addr) |
@@ -860,9 +1126,23 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
860 | cmdlist->data[cmdlist->last++] = G2D_SRC_BASE_ADDR; | 1126 | cmdlist->data[cmdlist->last++] = G2D_SRC_BASE_ADDR; |
861 | cmdlist->data[cmdlist->last++] = 0; | 1127 | cmdlist->data[cmdlist->last++] = 0; |
862 | 1128 | ||
1129 | /* | ||
1130 | * 'LIST_HOLD' command should be set to the DMA_HOLD_CMD_REG | ||
1131 | * and GCF bit should be set to INTEN register if user wants | ||
1132 | * G2D interrupt event once current command list execution is | ||
1133 | * finished. | ||
1134 | * Otherwise only ACF bit should be set to INTEN register so | ||
1135 | * that one interrupt is occured after all command lists | ||
1136 | * have been completed. | ||
1137 | */ | ||
863 | if (node->event) { | 1138 | if (node->event) { |
1139 | cmdlist->data[cmdlist->last++] = G2D_INTEN; | ||
1140 | cmdlist->data[cmdlist->last++] = G2D_INTEN_ACF | G2D_INTEN_GCF; | ||
864 | cmdlist->data[cmdlist->last++] = G2D_DMA_HOLD_CMD; | 1141 | cmdlist->data[cmdlist->last++] = G2D_DMA_HOLD_CMD; |
865 | cmdlist->data[cmdlist->last++] = G2D_LIST_HOLD; | 1142 | cmdlist->data[cmdlist->last++] = G2D_LIST_HOLD; |
1143 | } else { | ||
1144 | cmdlist->data[cmdlist->last++] = G2D_INTEN; | ||
1145 | cmdlist->data[cmdlist->last++] = G2D_INTEN_ACF; | ||
866 | } | 1146 | } |
867 | 1147 | ||
868 | /* Check size of cmdlist: last 2 is about G2D_BITBLT_START */ | 1148 | /* Check size of cmdlist: last 2 is about G2D_BITBLT_START */ |
@@ -887,7 +1167,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
887 | if (ret < 0) | 1167 | if (ret < 0) |
888 | goto err_free_event; | 1168 | goto err_free_event; |
889 | 1169 | ||
890 | node->map_nr = req->cmd_buf_nr; | 1170 | node->buf_info.map_nr = req->cmd_buf_nr; |
891 | if (req->cmd_buf_nr) { | 1171 | if (req->cmd_buf_nr) { |
892 | struct drm_exynos_g2d_cmd *cmd_buf; | 1172 | struct drm_exynos_g2d_cmd *cmd_buf; |
893 | 1173 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 67e17ce112b6..0e6fe000578c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -164,6 +164,27 @@ out: | |||
164 | exynos_gem_obj = NULL; | 164 | exynos_gem_obj = NULL; |
165 | } | 165 | } |
166 | 166 | ||
167 | unsigned long exynos_drm_gem_get_size(struct drm_device *dev, | ||
168 | unsigned int gem_handle, | ||
169 | struct drm_file *file_priv) | ||
170 | { | ||
171 | struct exynos_drm_gem_obj *exynos_gem_obj; | ||
172 | struct drm_gem_object *obj; | ||
173 | |||
174 | obj = drm_gem_object_lookup(dev, file_priv, gem_handle); | ||
175 | if (!obj) { | ||
176 | DRM_ERROR("failed to lookup gem object.\n"); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | exynos_gem_obj = to_exynos_gem_obj(obj); | ||
181 | |||
182 | drm_gem_object_unreference_unlocked(obj); | ||
183 | |||
184 | return exynos_gem_obj->buffer->size; | ||
185 | } | ||
186 | |||
187 | |||
167 | struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, | 188 | struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, |
168 | unsigned long size) | 189 | unsigned long size) |
169 | { | 190 | { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index 35ebac47dc2b..468766bee450 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -130,6 +130,11 @@ int exynos_drm_gem_userptr_ioctl(struct drm_device *dev, void *data, | |||
130 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, | 130 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, |
131 | struct drm_file *file_priv); | 131 | struct drm_file *file_priv); |
132 | 132 | ||
133 | /* get buffer size to gem handle. */ | ||
134 | unsigned long exynos_drm_gem_get_size(struct drm_device *dev, | ||
135 | unsigned int gem_handle, | ||
136 | struct drm_file *file_priv); | ||
137 | |||
133 | /* initialize gem object. */ | 138 | /* initialize gem object. */ |
134 | int exynos_drm_gem_init_object(struct drm_gem_object *obj); | 139 | int exynos_drm_gem_init_object(struct drm_gem_object *obj); |
135 | 140 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 13ccbd4bcfaa..9504b0cd825a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -117,13 +117,12 @@ static struct edid *vidi_get_edid(struct device *dev, | |||
117 | } | 117 | } |
118 | 118 | ||
119 | edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; | 119 | edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; |
120 | edid = kzalloc(edid_len, GFP_KERNEL); | 120 | edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL); |
121 | if (!edid) { | 121 | if (!edid) { |
122 | DRM_DEBUG_KMS("failed to allocate edid\n"); | 122 | DRM_DEBUG_KMS("failed to allocate edid\n"); |
123 | return ERR_PTR(-ENOMEM); | 123 | return ERR_PTR(-ENOMEM); |
124 | } | 124 | } |
125 | 125 | ||
126 | memcpy(edid, ctx->raw_edid, edid_len); | ||
127 | return edid; | 126 | return edid; |
128 | } | 127 | } |
129 | 128 | ||
@@ -563,12 +562,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
563 | return -EINVAL; | 562 | return -EINVAL; |
564 | } | 563 | } |
565 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; | 564 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; |
566 | ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); | 565 | ctx->raw_edid = kmemdup(raw_edid, edid_len, GFP_KERNEL); |
567 | if (!ctx->raw_edid) { | 566 | if (!ctx->raw_edid) { |
568 | DRM_DEBUG_KMS("failed to allocate raw_edid.\n"); | 567 | DRM_DEBUG_KMS("failed to allocate raw_edid.\n"); |
569 | return -ENOMEM; | 568 | return -ENOMEM; |
570 | } | 569 | } |
571 | memcpy(ctx->raw_edid, raw_edid, edid_len); | ||
572 | } else { | 570 | } else { |
573 | /* | 571 | /* |
574 | * with connection = 0, free raw_edid | 572 | * with connection = 0, free raw_edid |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index e919aba29b3d..2f4f72f07047 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -818,7 +818,7 @@ static void mixer_win_disable(void *ctx, int win) | |||
818 | mixer_ctx->win_data[win].enabled = false; | 818 | mixer_ctx->win_data[win].enabled = false; |
819 | } | 819 | } |
820 | 820 | ||
821 | int mixer_check_timing(void *ctx, struct fb_videomode *timing) | 821 | static int mixer_check_timing(void *ctx, struct fb_videomode *timing) |
822 | { | 822 | { |
823 | struct mixer_context *mixer_ctx = ctx; | 823 | struct mixer_context *mixer_ctx = ctx; |
824 | u32 w, h; | 824 | u32 w, h; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index aae31489c893..7299ea45dd03 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -103,7 +103,7 @@ static const char *cache_level_str(int type) | |||
103 | static void | 103 | static void |
104 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | 104 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
105 | { | 105 | { |
106 | seq_printf(m, "%p: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", | 106 | seq_printf(m, "%pK: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", |
107 | &obj->base, | 107 | &obj->base, |
108 | get_pin_flag(obj), | 108 | get_pin_flag(obj), |
109 | get_tiling_flag(obj), | 109 | get_tiling_flag(obj), |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0a8eceb75902..e9b57893db2b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -125,6 +125,11 @@ MODULE_PARM_DESC(preliminary_hw_support, | |||
125 | "Enable Haswell and ValleyView Support. " | 125 | "Enable Haswell and ValleyView Support. " |
126 | "(default: false)"); | 126 | "(default: false)"); |
127 | 127 | ||
128 | int i915_disable_power_well __read_mostly = 0; | ||
129 | module_param_named(disable_power_well, i915_disable_power_well, int, 0600); | ||
130 | MODULE_PARM_DESC(disable_power_well, | ||
131 | "Disable the power well when possible (default: false)"); | ||
132 | |||
128 | static struct drm_driver driver; | 133 | static struct drm_driver driver; |
129 | extern int intel_agp_enabled; | 134 | extern int intel_agp_enabled; |
130 | 135 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index e95337c97459..01769e2a9953 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1398,6 +1398,7 @@ extern int i915_enable_fbc __read_mostly; | |||
1398 | extern bool i915_enable_hangcheck __read_mostly; | 1398 | extern bool i915_enable_hangcheck __read_mostly; |
1399 | extern int i915_enable_ppgtt __read_mostly; | 1399 | extern int i915_enable_ppgtt __read_mostly; |
1400 | extern unsigned int i915_preliminary_hw_support __read_mostly; | 1400 | extern unsigned int i915_preliminary_hw_support __read_mostly; |
1401 | extern int i915_disable_power_well __read_mostly; | ||
1401 | 1402 | ||
1402 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1403 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
1403 | extern int i915_resume(struct drm_device *dev); | 1404 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 2f2daebd0eef..9a48e1a2d417 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -57,7 +57,7 @@ eb_create(struct drm_i915_gem_execbuffer2 *args) | |||
57 | if (eb == NULL) { | 57 | if (eb == NULL) { |
58 | int size = args->buffer_count; | 58 | int size = args->buffer_count; |
59 | int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; | 59 | int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; |
60 | BUILD_BUG_ON(!is_power_of_2(PAGE_SIZE / sizeof(struct hlist_head))); | 60 | BUILD_BUG_ON_NOT_POWER_OF_2(PAGE_SIZE / sizeof(struct hlist_head)); |
61 | while (count > 2*size) | 61 | while (count > 2*size) |
62 | count >>= 1; | 62 | count >>= 1; |
63 | eb = kzalloc(count*sizeof(struct hlist_head) + | 63 | eb = kzalloc(count*sizeof(struct hlist_head) + |
@@ -732,6 +732,8 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
732 | int count) | 732 | int count) |
733 | { | 733 | { |
734 | int i; | 734 | int i; |
735 | int relocs_total = 0; | ||
736 | int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry); | ||
735 | 737 | ||
736 | for (i = 0; i < count; i++) { | 738 | for (i = 0; i < count; i++) { |
737 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; | 739 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
@@ -740,10 +742,13 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
740 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) | 742 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) |
741 | return -EINVAL; | 743 | return -EINVAL; |
742 | 744 | ||
743 | /* First check for malicious input causing overflow */ | 745 | /* First check for malicious input causing overflow in |
744 | if (exec[i].relocation_count > | 746 | * the worst case where we need to allocate the entire |
745 | INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) | 747 | * relocation tree as a single array. |
748 | */ | ||
749 | if (exec[i].relocation_count > relocs_max - relocs_total) | ||
746 | return -EINVAL; | 750 | return -EINVAL; |
751 | relocs_total += exec[i].relocation_count; | ||
747 | 752 | ||
748 | length = exec[i].relocation_count * | 753 | length = exec[i].relocation_count * |
749 | sizeof(struct drm_i915_gem_relocation_entry); | 754 | sizeof(struct drm_i915_gem_relocation_entry); |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 32a3693905ec..1ce45a0a2d3e 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -45,6 +45,9 @@ | |||
45 | 45 | ||
46 | struct intel_crt { | 46 | struct intel_crt { |
47 | struct intel_encoder base; | 47 | struct intel_encoder base; |
48 | /* DPMS state is stored in the connector, which we need in the | ||
49 | * encoder's enable/disable callbacks */ | ||
50 | struct intel_connector *connector; | ||
48 | bool force_hotplug_required; | 51 | bool force_hotplug_required; |
49 | u32 adpa_reg; | 52 | u32 adpa_reg; |
50 | }; | 53 | }; |
@@ -81,29 +84,6 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder, | |||
81 | return true; | 84 | return true; |
82 | } | 85 | } |
83 | 86 | ||
84 | static void intel_disable_crt(struct intel_encoder *encoder) | ||
85 | { | ||
86 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
87 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | ||
88 | u32 temp; | ||
89 | |||
90 | temp = I915_READ(crt->adpa_reg); | ||
91 | temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE; | ||
92 | temp &= ~ADPA_DAC_ENABLE; | ||
93 | I915_WRITE(crt->adpa_reg, temp); | ||
94 | } | ||
95 | |||
96 | static void intel_enable_crt(struct intel_encoder *encoder) | ||
97 | { | ||
98 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
99 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | ||
100 | u32 temp; | ||
101 | |||
102 | temp = I915_READ(crt->adpa_reg); | ||
103 | temp |= ADPA_DAC_ENABLE; | ||
104 | I915_WRITE(crt->adpa_reg, temp); | ||
105 | } | ||
106 | |||
107 | /* Note: The caller is required to filter out dpms modes not supported by the | 87 | /* Note: The caller is required to filter out dpms modes not supported by the |
108 | * platform. */ | 88 | * platform. */ |
109 | static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) | 89 | static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) |
@@ -135,6 +115,19 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) | |||
135 | I915_WRITE(crt->adpa_reg, temp); | 115 | I915_WRITE(crt->adpa_reg, temp); |
136 | } | 116 | } |
137 | 117 | ||
118 | static void intel_disable_crt(struct intel_encoder *encoder) | ||
119 | { | ||
120 | intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF); | ||
121 | } | ||
122 | |||
123 | static void intel_enable_crt(struct intel_encoder *encoder) | ||
124 | { | ||
125 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | ||
126 | |||
127 | intel_crt_set_dpms(encoder, crt->connector->base.dpms); | ||
128 | } | ||
129 | |||
130 | |||
138 | static void intel_crt_dpms(struct drm_connector *connector, int mode) | 131 | static void intel_crt_dpms(struct drm_connector *connector, int mode) |
139 | { | 132 | { |
140 | struct drm_device *dev = connector->dev; | 133 | struct drm_device *dev = connector->dev; |
@@ -746,6 +739,7 @@ void intel_crt_init(struct drm_device *dev) | |||
746 | } | 739 | } |
747 | 740 | ||
748 | connector = &intel_connector->base; | 741 | connector = &intel_connector->base; |
742 | crt->connector = intel_connector; | ||
749 | drm_connector_init(dev, &intel_connector->base, | 743 | drm_connector_init(dev, &intel_connector->base, |
750 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | 744 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); |
751 | 745 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 287b42c9d1a8..b20d50192fcc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5771,6 +5771,11 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
5771 | num_connectors++; | 5771 | num_connectors++; |
5772 | } | 5772 | } |
5773 | 5773 | ||
5774 | if (is_cpu_edp) | ||
5775 | intel_crtc->cpu_transcoder = TRANSCODER_EDP; | ||
5776 | else | ||
5777 | intel_crtc->cpu_transcoder = pipe; | ||
5778 | |||
5774 | /* We are not sure yet this won't happen. */ | 5779 | /* We are not sure yet this won't happen. */ |
5775 | WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n", | 5780 | WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n", |
5776 | INTEL_PCH_TYPE(dev)); | 5781 | INTEL_PCH_TYPE(dev)); |
@@ -5837,11 +5842,6 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
5837 | int pipe = intel_crtc->pipe; | 5842 | int pipe = intel_crtc->pipe; |
5838 | int ret; | 5843 | int ret; |
5839 | 5844 | ||
5840 | if (IS_HASWELL(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) | ||
5841 | intel_crtc->cpu_transcoder = TRANSCODER_EDP; | ||
5842 | else | ||
5843 | intel_crtc->cpu_transcoder = pipe; | ||
5844 | |||
5845 | drm_vblank_pre_modeset(dev, pipe); | 5845 | drm_vblank_pre_modeset(dev, pipe); |
5846 | 5846 | ||
5847 | ret = dev_priv->display.crtc_mode_set(crtc, mode, adjusted_mode, | 5847 | ret = dev_priv->display.crtc_mode_set(crtc, mode, adjusted_mode, |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 6f728e5ee793..8fc93f90a7cd 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -820,6 +820,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
820 | struct intel_link_m_n m_n; | 820 | struct intel_link_m_n m_n; |
821 | int pipe = intel_crtc->pipe; | 821 | int pipe = intel_crtc->pipe; |
822 | enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; | 822 | enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; |
823 | int target_clock; | ||
823 | 824 | ||
824 | /* | 825 | /* |
825 | * Find the lane count in the intel_encoder private | 826 | * Find the lane count in the intel_encoder private |
@@ -835,13 +836,22 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
835 | } | 836 | } |
836 | } | 837 | } |
837 | 838 | ||
839 | target_clock = mode->clock; | ||
840 | for_each_encoder_on_crtc(dev, crtc, intel_encoder) { | ||
841 | if (intel_encoder->type == INTEL_OUTPUT_EDP) { | ||
842 | target_clock = intel_edp_target_clock(intel_encoder, | ||
843 | mode); | ||
844 | break; | ||
845 | } | ||
846 | } | ||
847 | |||
838 | /* | 848 | /* |
839 | * Compute the GMCH and Link ratios. The '3' here is | 849 | * Compute the GMCH and Link ratios. The '3' here is |
840 | * the number of bytes_per_pixel post-LUT, which we always | 850 | * the number of bytes_per_pixel post-LUT, which we always |
841 | * set up for 8-bits of R/G/B, or 3 bytes total. | 851 | * set up for 8-bits of R/G/B, or 3 bytes total. |
842 | */ | 852 | */ |
843 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, | 853 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, |
844 | mode->clock, adjusted_mode->clock, &m_n); | 854 | target_clock, adjusted_mode->clock, &m_n); |
845 | 855 | ||
846 | if (IS_HASWELL(dev)) { | 856 | if (IS_HASWELL(dev)) { |
847 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), | 857 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), |
@@ -1930,7 +1940,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1930 | for (i = 0; i < intel_dp->lane_count; i++) | 1940 | for (i = 0; i < intel_dp->lane_count; i++) |
1931 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1941 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1932 | break; | 1942 | break; |
1933 | if (i == intel_dp->lane_count && voltage_tries == 5) { | 1943 | if (i == intel_dp->lane_count) { |
1934 | ++loop_tries; | 1944 | ++loop_tries; |
1935 | if (loop_tries == 5) { | 1945 | if (loop_tries == 5) { |
1936 | DRM_DEBUG_KMS("too many full retries, give up\n"); | 1946 | DRM_DEBUG_KMS("too many full retries, give up\n"); |
@@ -2549,12 +2559,15 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
2549 | { | 2559 | { |
2550 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); | 2560 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
2551 | struct intel_dp *intel_dp = &intel_dig_port->dp; | 2561 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
2562 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
2552 | 2563 | ||
2553 | i2c_del_adapter(&intel_dp->adapter); | 2564 | i2c_del_adapter(&intel_dp->adapter); |
2554 | drm_encoder_cleanup(encoder); | 2565 | drm_encoder_cleanup(encoder); |
2555 | if (is_edp(intel_dp)) { | 2566 | if (is_edp(intel_dp)) { |
2556 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | 2567 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); |
2568 | mutex_lock(&dev->mode_config.mutex); | ||
2557 | ironlake_panel_vdd_off_sync(intel_dp); | 2569 | ironlake_panel_vdd_off_sync(intel_dp); |
2570 | mutex_unlock(&dev->mode_config.mutex); | ||
2558 | } | 2571 | } |
2559 | kfree(intel_dig_port); | 2572 | kfree(intel_dig_port); |
2560 | } | 2573 | } |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index acf8aec9ada7..ef4744e1bf0b 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -203,7 +203,13 @@ intel_gpio_setup(struct intel_gmbus *bus, u32 pin) | |||
203 | algo->data = bus; | 203 | algo->data = bus; |
204 | } | 204 | } |
205 | 205 | ||
206 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 4) | 206 | /* |
207 | * gmbus on gen4 seems to be able to generate legacy interrupts even when in MSI | ||
208 | * mode. This results in spurious interrupt warnings if the legacy irq no. is | ||
209 | * shared with another device. The kernel then disables that interrupt source | ||
210 | * and so prevents the other device from working properly. | ||
211 | */ | ||
212 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) | ||
207 | static int | 213 | static int |
208 | gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | 214 | gmbus_wait_hw_status(struct drm_i915_private *dev_priv, |
209 | u32 gmbus2_status, | 215 | u32 gmbus2_status, |
@@ -214,6 +220,9 @@ gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | |||
214 | u32 gmbus2 = 0; | 220 | u32 gmbus2 = 0; |
215 | DEFINE_WAIT(wait); | 221 | DEFINE_WAIT(wait); |
216 | 222 | ||
223 | if (!HAS_GMBUS_IRQ(dev_priv->dev)) | ||
224 | gmbus4_irq_en = 0; | ||
225 | |||
217 | /* Important: The hw handles only the first bit, so set only one! Since | 226 | /* Important: The hw handles only the first bit, so set only one! Since |
218 | * we also need to check for NAKs besides the hw ready/idle signal, we | 227 | * we also need to check for NAKs besides the hw ready/idle signal, we |
219 | * need to wake up periodically and check that ourselves. */ | 228 | * need to wake up periodically and check that ourselves. */ |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index a3730e0289e5..bee8cb6108a7 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -321,9 +321,6 @@ void intel_panel_enable_backlight(struct drm_device *dev, | |||
321 | if (dev_priv->backlight_level == 0) | 321 | if (dev_priv->backlight_level == 0) |
322 | dev_priv->backlight_level = intel_panel_get_max_backlight(dev); | 322 | dev_priv->backlight_level = intel_panel_get_max_backlight(dev); |
323 | 323 | ||
324 | dev_priv->backlight_enabled = true; | ||
325 | intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); | ||
326 | |||
327 | if (INTEL_INFO(dev)->gen >= 4) { | 324 | if (INTEL_INFO(dev)->gen >= 4) { |
328 | uint32_t reg, tmp; | 325 | uint32_t reg, tmp; |
329 | 326 | ||
@@ -359,12 +356,12 @@ void intel_panel_enable_backlight(struct drm_device *dev, | |||
359 | } | 356 | } |
360 | 357 | ||
361 | set_level: | 358 | set_level: |
362 | /* Check the current backlight level and try to set again if it's zero. | 359 | /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. |
363 | * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically | 360 | * BLC_PWM_CPU_CTL may be cleared to zero automatically when these |
364 | * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written. | 361 | * registers are set. |
365 | */ | 362 | */ |
366 | if (!intel_panel_get_backlight(dev)) | 363 | dev_priv->backlight_enabled = true; |
367 | intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); | 364 | intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); |
368 | } | 365 | } |
369 | 366 | ||
370 | static void intel_panel_init_backlight(struct drm_device *dev) | 367 | static void intel_panel_init_backlight(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a1794c6df1bf..adca00783e61 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -4079,6 +4079,9 @@ void intel_set_power_well(struct drm_device *dev, bool enable) | |||
4079 | if (!IS_HASWELL(dev)) | 4079 | if (!IS_HASWELL(dev)) |
4080 | return; | 4080 | return; |
4081 | 4081 | ||
4082 | if (!i915_disable_power_well && !enable) | ||
4083 | return; | ||
4084 | |||
4082 | tmp = I915_READ(HSW_PWR_WELL_DRIVER); | 4085 | tmp = I915_READ(HSW_PWR_WELL_DRIVER); |
4083 | is_enabled = tmp & HSW_PWR_WELL_STATE; | 4086 | is_enabled = tmp & HSW_PWR_WELL_STATE; |
4084 | enable_requested = tmp & HSW_PWR_WELL_ENABLE; | 4087 | enable_requested = tmp & HSW_PWR_WELL_ENABLE; |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index a274b9906ef8..78d8e919509f 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
382 | m = n = p = 0; | 382 | m = n = p = 0; |
383 | vcomax = 800000; | 383 | vcomax = 800000; |
384 | vcomin = 400000; | 384 | vcomin = 400000; |
385 | pllreffreq = 3333; | 385 | pllreffreq = 33333; |
386 | 386 | ||
387 | delta = 0xffffffff; | 387 | delta = 0xffffffff; |
388 | permitteddelta = clock * 5 / 1000; | 388 | permitteddelta = clock * 5 / 1000; |
389 | 389 | ||
390 | for (testp = 16; testp > 0; testp--) { | 390 | for (testp = 16; testp > 0; testp >>= 1) { |
391 | if (clock * testp > vcomax) | 391 | if (clock * testp > vcomax) |
392 | continue; | 392 | continue; |
393 | if (clock * testp < vcomin) | 393 | if (clock * testp < vcomin) |
394 | continue; | 394 | continue; |
395 | 395 | ||
396 | for (testm = 1; testm < 33; testm++) { | 396 | for (testm = 1; testm < 33; testm++) { |
397 | for (testn = 1; testn < 257; testn++) { | 397 | for (testn = 17; testn < 257; testn++) { |
398 | computed = (pllreffreq * testn) / | 398 | computed = (pllreffreq * testn) / |
399 | (testm * testp); | 399 | (testm * testp); |
400 | if (computed > clock) | 400 | if (computed > clock) |
@@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
404 | if (tmpdelta < delta) { | 404 | if (tmpdelta < delta) { |
405 | delta = tmpdelta; | 405 | delta = tmpdelta; |
406 | n = testn - 1; | 406 | n = testn - 1; |
407 | m = (testm - 1) | ((n >> 1) & 0x80); | 407 | m = (testm - 1); |
408 | p = testp - 1; | 408 | p = testp - 1; |
409 | } | 409 | } |
410 | if ((clock * testp) >= 600000) | 410 | if ((clock * testp) >= 600000) |
411 | p |= 80; | 411 | p |= 0x80; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
@@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
751 | int i; | 751 | int i; |
752 | unsigned char misc = 0; | 752 | unsigned char misc = 0; |
753 | unsigned char ext_vga[6]; | 753 | unsigned char ext_vga[6]; |
754 | unsigned char ext_vga_index24; | ||
755 | unsigned char dac_index90 = 0; | ||
756 | u8 bppshift; | 754 | u8 bppshift; |
757 | 755 | ||
758 | static unsigned char dacvalue[] = { | 756 | static unsigned char dacvalue[] = { |
@@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
803 | option2 = 0x0000b000; | 801 | option2 = 0x0000b000; |
804 | break; | 802 | break; |
805 | case G200_ER: | 803 | case G200_ER: |
806 | dac_index90 = 0; | ||
807 | break; | 804 | break; |
808 | } | 805 | } |
809 | 806 | ||
@@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
852 | WREG_DAC(i, dacvalue[i]); | 849 | WREG_DAC(i, dacvalue[i]); |
853 | } | 850 | } |
854 | 851 | ||
855 | if (mdev->type == G200_ER) { | 852 | if (mdev->type == G200_ER) |
856 | WREG_DAC(0x90, dac_index90); | 853 | WREG_DAC(0x90, 0); |
857 | } | ||
858 | |||
859 | 854 | ||
860 | if (option) | 855 | if (option) |
861 | pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option); | 856 | pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option); |
@@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
952 | if (mdev->type == G200_WB) | 947 | if (mdev->type == G200_WB) |
953 | ext_vga[1] |= 0x88; | 948 | ext_vga[1] |= 0x88; |
954 | 949 | ||
955 | ext_vga_index24 = 0x05; | ||
956 | |||
957 | /* Set pixel clocks */ | 950 | /* Set pixel clocks */ |
958 | misc = 0x2d; | 951 | misc = 0x2d; |
959 | WREG8(MGA_MISC_OUT, misc); | 952 | WREG8(MGA_MISC_OUT, misc); |
@@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
965 | } | 958 | } |
966 | 959 | ||
967 | if (mdev->type == G200_ER) | 960 | if (mdev->type == G200_ER) |
968 | WREG_ECRT(24, ext_vga_index24); | 961 | WREG_ECRT(0x24, 0x5); |
969 | 962 | ||
970 | if (mdev->type == G200_EV) { | 963 | if (mdev->type == G200_EV) { |
971 | WREG_ECRT(6, 0); | 964 | WREG_ECRT(6, 0); |
diff --git a/drivers/gpu/drm/nouveau/core/core/object.c b/drivers/gpu/drm/nouveau/core/core/object.c index 0daab62ea14c..3b2e7b6304d3 100644 --- a/drivers/gpu/drm/nouveau/core/core/object.c +++ b/drivers/gpu/drm/nouveau/core/core/object.c | |||
@@ -278,7 +278,6 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle) | |||
278 | struct nouveau_object *parent = NULL; | 278 | struct nouveau_object *parent = NULL; |
279 | struct nouveau_object *namedb = NULL; | 279 | struct nouveau_object *namedb = NULL; |
280 | struct nouveau_handle *handle = NULL; | 280 | struct nouveau_handle *handle = NULL; |
281 | int ret = -EINVAL; | ||
282 | 281 | ||
283 | parent = nouveau_handle_ref(client, _parent); | 282 | parent = nouveau_handle_ref(client, _parent); |
284 | if (!parent) | 283 | if (!parent) |
@@ -295,7 +294,7 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle) | |||
295 | } | 294 | } |
296 | 295 | ||
297 | nouveau_object_ref(NULL, &parent); | 296 | nouveau_object_ref(NULL, &parent); |
298 | return ret; | 297 | return handle ? 0 : -EINVAL; |
299 | } | 298 | } |
300 | 299 | ||
301 | int | 300 | int |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 5fa13267bd9f..02e369f80449 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -544,13 +544,13 @@ nv50_disp_curs_ofuncs = { | |||
544 | static void | 544 | static void |
545 | nv50_disp_base_vblank_enable(struct nouveau_event *event, int head) | 545 | nv50_disp_base_vblank_enable(struct nouveau_event *event, int head) |
546 | { | 546 | { |
547 | nv_mask(event->priv, 0x61002c, (1 << head), (1 << head)); | 547 | nv_mask(event->priv, 0x61002c, (4 << head), (4 << head)); |
548 | } | 548 | } |
549 | 549 | ||
550 | static void | 550 | static void |
551 | nv50_disp_base_vblank_disable(struct nouveau_event *event, int head) | 551 | nv50_disp_base_vblank_disable(struct nouveau_event *event, int head) |
552 | { | 552 | { |
553 | nv_mask(event->priv, 0x61002c, (1 << head), (0 << head)); | 553 | nv_mask(event->priv, 0x61002c, (4 << head), 0); |
554 | } | 554 | } |
555 | 555 | ||
556 | static int | 556 | static int |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h index 6b17b614629f..0b20fc0d19c1 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <core/device.h> | 4 | #include <core/device.h> |
5 | #include <core/subdev.h> | 5 | #include <core/subdev.h> |
6 | 6 | ||
7 | enum nouveau_therm_mode { | 7 | enum nouveau_therm_fan_mode { |
8 | NOUVEAU_THERM_CTRL_NONE = 0, | 8 | NOUVEAU_THERM_CTRL_NONE = 0, |
9 | NOUVEAU_THERM_CTRL_MANUAL = 1, | 9 | NOUVEAU_THERM_CTRL_MANUAL = 1, |
10 | NOUVEAU_THERM_CTRL_AUTO = 2, | 10 | NOUVEAU_THERM_CTRL_AUTO = 2, |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index e816f06637a7..0e2c1a4f1659 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -248,6 +248,22 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios) | |||
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | static void | ||
252 | nouveau_bios_shadow_platform(struct nouveau_bios *bios) | ||
253 | { | ||
254 | struct pci_dev *pdev = nv_device(bios)->pdev; | ||
255 | size_t size; | ||
256 | |||
257 | void __iomem *rom = pci_platform_rom(pdev, &size); | ||
258 | if (rom && size) { | ||
259 | bios->data = kmalloc(size, GFP_KERNEL); | ||
260 | if (bios->data) { | ||
261 | memcpy_fromio(bios->data, rom, size); | ||
262 | bios->size = size; | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | |||
251 | static int | 267 | static int |
252 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) | 268 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) |
253 | { | 269 | { |
@@ -288,6 +304,7 @@ nouveau_bios_shadow(struct nouveau_bios *bios) | |||
288 | { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL }, | 304 | { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL }, |
289 | { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL }, | 305 | { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL }, |
290 | { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL }, | 306 | { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL }, |
307 | { "PLATFORM", nouveau_bios_shadow_platform, true, 0, 0, NULL }, | ||
291 | {} | 308 | {} |
292 | }; | 309 | }; |
293 | struct methods *mthd, *best; | 310 | struct methods *mthd, *best; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c index f794dc89a3b2..a00a5a76e2d6 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c | |||
@@ -134,7 +134,7 @@ nouveau_therm_alarm(struct nouveau_alarm *alarm) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | int | 136 | int |
137 | nouveau_therm_mode(struct nouveau_therm *therm, int mode) | 137 | nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode) |
138 | { | 138 | { |
139 | struct nouveau_therm_priv *priv = (void *)therm; | 139 | struct nouveau_therm_priv *priv = (void *)therm; |
140 | struct nouveau_device *device = nv_device(therm); | 140 | struct nouveau_device *device = nv_device(therm); |
@@ -149,10 +149,15 @@ nouveau_therm_mode(struct nouveau_therm *therm, int mode) | |||
149 | (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) | 149 | (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) |
150 | return -EINVAL; | 150 | return -EINVAL; |
151 | 151 | ||
152 | /* do not allow automatic fan management if the thermal sensor is | ||
153 | * not available */ | ||
154 | if (priv->mode == 2 && therm->temp_get(therm) < 0) | ||
155 | return -EINVAL; | ||
156 | |||
152 | if (priv->mode == mode) | 157 | if (priv->mode == mode) |
153 | return 0; | 158 | return 0; |
154 | 159 | ||
155 | nv_info(therm, "Thermal management: %s\n", name[mode]); | 160 | nv_info(therm, "fan management: %s\n", name[mode]); |
156 | nouveau_therm_update(therm, mode); | 161 | nouveau_therm_update(therm, mode); |
157 | return 0; | 162 | return 0; |
158 | } | 163 | } |
@@ -213,7 +218,7 @@ nouveau_therm_attr_set(struct nouveau_therm *therm, | |||
213 | priv->fan->bios.max_duty = value; | 218 | priv->fan->bios.max_duty = value; |
214 | return 0; | 219 | return 0; |
215 | case NOUVEAU_THERM_ATTR_FAN_MODE: | 220 | case NOUVEAU_THERM_ATTR_FAN_MODE: |
216 | return nouveau_therm_mode(therm, value); | 221 | return nouveau_therm_fan_mode(therm, value); |
217 | case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: | 222 | case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: |
218 | priv->bios_sensor.thrs_fan_boost.temp = value; | 223 | priv->bios_sensor.thrs_fan_boost.temp = value; |
219 | priv->sensor.program_alarms(therm); | 224 | priv->sensor.program_alarms(therm); |
@@ -263,7 +268,7 @@ _nouveau_therm_init(struct nouveau_object *object) | |||
263 | return ret; | 268 | return ret; |
264 | 269 | ||
265 | if (priv->suspend >= 0) | 270 | if (priv->suspend >= 0) |
266 | nouveau_therm_mode(therm, priv->mode); | 271 | nouveau_therm_fan_mode(therm, priv->mode); |
267 | priv->sensor.program_alarms(therm); | 272 | priv->sensor.program_alarms(therm); |
268 | return 0; | 273 | return 0; |
269 | } | 274 | } |
@@ -313,11 +318,12 @@ nouveau_therm_create_(struct nouveau_object *parent, | |||
313 | int | 318 | int |
314 | nouveau_therm_preinit(struct nouveau_therm *therm) | 319 | nouveau_therm_preinit(struct nouveau_therm *therm) |
315 | { | 320 | { |
316 | nouveau_therm_ic_ctor(therm); | ||
317 | nouveau_therm_sensor_ctor(therm); | 321 | nouveau_therm_sensor_ctor(therm); |
322 | nouveau_therm_ic_ctor(therm); | ||
318 | nouveau_therm_fan_ctor(therm); | 323 | nouveau_therm_fan_ctor(therm); |
319 | 324 | ||
320 | nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_NONE); | 325 | nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_NONE); |
326 | nouveau_therm_sensor_preinit(therm); | ||
321 | return 0; | 327 | return 0; |
322 | } | 328 | } |
323 | 329 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c index e24090bac195..8b3adec5fbb1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c | |||
@@ -32,6 +32,7 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, | |||
32 | struct i2c_board_info *info) | 32 | struct i2c_board_info *info) |
33 | { | 33 | { |
34 | struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); | 34 | struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); |
35 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; | ||
35 | struct i2c_client *client; | 36 | struct i2c_client *client; |
36 | 37 | ||
37 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); | 38 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); |
@@ -46,8 +47,9 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, | |||
46 | } | 47 | } |
47 | 48 | ||
48 | nv_info(priv, | 49 | nv_info(priv, |
49 | "Found an %s at address 0x%x (controlled by lm_sensors)\n", | 50 | "Found an %s at address 0x%x (controlled by lm_sensors, " |
50 | info->type, info->addr); | 51 | "temp offset %+i C)\n", |
52 | info->type, info->addr, sensor->offset_constant); | ||
51 | priv->ic = client; | 53 | priv->ic = client; |
52 | 54 | ||
53 | return true; | 55 | return true; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c index 0f5363edb964..a70d1b7e397b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c | |||
@@ -29,54 +29,83 @@ struct nv40_therm_priv { | |||
29 | struct nouveau_therm_priv base; | 29 | struct nouveau_therm_priv base; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | enum nv40_sensor_style { INVALID_STYLE = -1, OLD_STYLE = 0, NEW_STYLE = 1 }; | ||
33 | |||
34 | static enum nv40_sensor_style | ||
35 | nv40_sensor_style(struct nouveau_therm *therm) | ||
36 | { | ||
37 | struct nouveau_device *device = nv_device(therm); | ||
38 | |||
39 | switch (device->chipset) { | ||
40 | case 0x43: | ||
41 | case 0x44: | ||
42 | case 0x4a: | ||
43 | case 0x47: | ||
44 | return OLD_STYLE; | ||
45 | |||
46 | case 0x46: | ||
47 | case 0x49: | ||
48 | case 0x4b: | ||
49 | case 0x4e: | ||
50 | case 0x4c: | ||
51 | case 0x67: | ||
52 | case 0x68: | ||
53 | case 0x63: | ||
54 | return NEW_STYLE; | ||
55 | default: | ||
56 | return INVALID_STYLE; | ||
57 | } | ||
58 | } | ||
59 | |||
32 | static int | 60 | static int |
33 | nv40_sensor_setup(struct nouveau_therm *therm) | 61 | nv40_sensor_setup(struct nouveau_therm *therm) |
34 | { | 62 | { |
35 | struct nouveau_device *device = nv_device(therm); | 63 | enum nv40_sensor_style style = nv40_sensor_style(therm); |
36 | 64 | ||
37 | /* enable ADC readout and disable the ALARM threshold */ | 65 | /* enable ADC readout and disable the ALARM threshold */ |
38 | if (device->chipset >= 0x46) { | 66 | if (style == NEW_STYLE) { |
39 | nv_mask(therm, 0x15b8, 0x80000000, 0); | 67 | nv_mask(therm, 0x15b8, 0x80000000, 0); |
40 | nv_wr32(therm, 0x15b0, 0x80003fff); | 68 | nv_wr32(therm, 0x15b0, 0x80003fff); |
41 | mdelay(10); /* wait for the temperature to stabilize */ | 69 | mdelay(20); /* wait for the temperature to stabilize */ |
42 | return nv_rd32(therm, 0x15b4) & 0x3fff; | 70 | return nv_rd32(therm, 0x15b4) & 0x3fff; |
43 | } else { | 71 | } else if (style == OLD_STYLE) { |
44 | nv_wr32(therm, 0x15b0, 0xff); | 72 | nv_wr32(therm, 0x15b0, 0xff); |
73 | mdelay(20); /* wait for the temperature to stabilize */ | ||
45 | return nv_rd32(therm, 0x15b4) & 0xff; | 74 | return nv_rd32(therm, 0x15b4) & 0xff; |
46 | } | 75 | } else |
76 | return -ENODEV; | ||
47 | } | 77 | } |
48 | 78 | ||
49 | static int | 79 | static int |
50 | nv40_temp_get(struct nouveau_therm *therm) | 80 | nv40_temp_get(struct nouveau_therm *therm) |
51 | { | 81 | { |
52 | struct nouveau_therm_priv *priv = (void *)therm; | 82 | struct nouveau_therm_priv *priv = (void *)therm; |
53 | struct nouveau_device *device = nv_device(therm); | ||
54 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; | 83 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; |
84 | enum nv40_sensor_style style = nv40_sensor_style(therm); | ||
55 | int core_temp; | 85 | int core_temp; |
56 | 86 | ||
57 | if (device->chipset >= 0x46) { | 87 | if (style == NEW_STYLE) { |
58 | nv_wr32(therm, 0x15b0, 0x80003fff); | 88 | nv_wr32(therm, 0x15b0, 0x80003fff); |
59 | core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; | 89 | core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; |
60 | } else { | 90 | } else if (style == OLD_STYLE) { |
61 | nv_wr32(therm, 0x15b0, 0xff); | 91 | nv_wr32(therm, 0x15b0, 0xff); |
62 | core_temp = nv_rd32(therm, 0x15b4) & 0xff; | 92 | core_temp = nv_rd32(therm, 0x15b4) & 0xff; |
63 | } | 93 | } else |
64 | 94 | return -ENODEV; | |
65 | /* Setup the sensor if the temperature is 0 */ | ||
66 | if (core_temp == 0) | ||
67 | core_temp = nv40_sensor_setup(therm); | ||
68 | 95 | ||
69 | if (sensor->slope_div == 0) | 96 | /* if the slope or the offset is unset, do no use the sensor */ |
70 | sensor->slope_div = 1; | 97 | if (!sensor->slope_div || !sensor->slope_mult || |
71 | if (sensor->offset_den == 0) | 98 | !sensor->offset_num || !sensor->offset_den) |
72 | sensor->offset_den = 1; | 99 | return -ENODEV; |
73 | if (sensor->slope_mult < 1) | ||
74 | sensor->slope_mult = 1; | ||
75 | 100 | ||
76 | core_temp = core_temp * sensor->slope_mult / sensor->slope_div; | 101 | core_temp = core_temp * sensor->slope_mult / sensor->slope_div; |
77 | core_temp = core_temp + sensor->offset_num / sensor->offset_den; | 102 | core_temp = core_temp + sensor->offset_num / sensor->offset_den; |
78 | core_temp = core_temp + sensor->offset_constant - 8; | 103 | core_temp = core_temp + sensor->offset_constant - 8; |
79 | 104 | ||
105 | /* reserve negative temperatures for errors */ | ||
106 | if (core_temp < 0) | ||
107 | core_temp = 0; | ||
108 | |||
80 | return core_temp; | 109 | return core_temp; |
81 | } | 110 | } |
82 | 111 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h index 06b98706b3fc..438d9824b774 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h | |||
@@ -102,7 +102,7 @@ struct nouveau_therm_priv { | |||
102 | struct i2c_client *ic; | 102 | struct i2c_client *ic; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | int nouveau_therm_mode(struct nouveau_therm *therm, int mode); | 105 | int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode); |
106 | int nouveau_therm_attr_get(struct nouveau_therm *therm, | 106 | int nouveau_therm_attr_get(struct nouveau_therm *therm, |
107 | enum nouveau_therm_attr_type type); | 107 | enum nouveau_therm_attr_type type); |
108 | int nouveau_therm_attr_set(struct nouveau_therm *therm, | 108 | int nouveau_therm_attr_set(struct nouveau_therm *therm, |
@@ -122,6 +122,7 @@ int nouveau_therm_fan_sense(struct nouveau_therm *therm); | |||
122 | 122 | ||
123 | int nouveau_therm_preinit(struct nouveau_therm *); | 123 | int nouveau_therm_preinit(struct nouveau_therm *); |
124 | 124 | ||
125 | void nouveau_therm_sensor_preinit(struct nouveau_therm *); | ||
125 | void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, | 126 | void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, |
126 | enum nouveau_therm_thrs thrs, | 127 | enum nouveau_therm_thrs thrs, |
127 | enum nouveau_therm_thrs_state st); | 128 | enum nouveau_therm_thrs_state st); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c index b37624af8297..470f6a47b656 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | |||
@@ -34,10 +34,6 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm) | |||
34 | { | 34 | { |
35 | struct nouveau_therm_priv *priv = (void *)therm; | 35 | struct nouveau_therm_priv *priv = (void *)therm; |
36 | 36 | ||
37 | priv->bios_sensor.slope_mult = 1; | ||
38 | priv->bios_sensor.slope_div = 1; | ||
39 | priv->bios_sensor.offset_num = 0; | ||
40 | priv->bios_sensor.offset_den = 1; | ||
41 | priv->bios_sensor.offset_constant = 0; | 37 | priv->bios_sensor.offset_constant = 0; |
42 | 38 | ||
43 | priv->bios_sensor.thrs_fan_boost.temp = 90; | 39 | priv->bios_sensor.thrs_fan_boost.temp = 90; |
@@ -60,11 +56,6 @@ nouveau_therm_temp_safety_checks(struct nouveau_therm *therm) | |||
60 | struct nouveau_therm_priv *priv = (void *)therm; | 56 | struct nouveau_therm_priv *priv = (void *)therm; |
61 | struct nvbios_therm_sensor *s = &priv->bios_sensor; | 57 | struct nvbios_therm_sensor *s = &priv->bios_sensor; |
62 | 58 | ||
63 | if (!priv->bios_sensor.slope_div) | ||
64 | priv->bios_sensor.slope_div = 1; | ||
65 | if (!priv->bios_sensor.offset_den) | ||
66 | priv->bios_sensor.offset_den = 1; | ||
67 | |||
68 | /* enforce a minimum hysteresis on thresholds */ | 59 | /* enforce a minimum hysteresis on thresholds */ |
69 | s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); | 60 | s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); |
70 | s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); | 61 | s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); |
@@ -106,16 +97,16 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm, | |||
106 | const char *thresolds[] = { | 97 | const char *thresolds[] = { |
107 | "fanboost", "downclock", "critical", "shutdown" | 98 | "fanboost", "downclock", "critical", "shutdown" |
108 | }; | 99 | }; |
109 | uint8_t temperature = therm->temp_get(therm); | 100 | int temperature = therm->temp_get(therm); |
110 | 101 | ||
111 | if (thrs < 0 || thrs > 3) | 102 | if (thrs < 0 || thrs > 3) |
112 | return; | 103 | return; |
113 | 104 | ||
114 | if (dir == NOUVEAU_THERM_THRS_FALLING) | 105 | if (dir == NOUVEAU_THERM_THRS_FALLING) |
115 | nv_info(therm, "temperature (%u C) went below the '%s' threshold\n", | 106 | nv_info(therm, "temperature (%i C) went below the '%s' threshold\n", |
116 | temperature, thresolds[thrs]); | 107 | temperature, thresolds[thrs]); |
117 | else | 108 | else |
118 | nv_info(therm, "temperature (%u C) hit the '%s' threshold\n", | 109 | nv_info(therm, "temperature (%i C) hit the '%s' threshold\n", |
119 | temperature, thresolds[thrs]); | 110 | temperature, thresolds[thrs]); |
120 | 111 | ||
121 | active = (dir == NOUVEAU_THERM_THRS_RISING); | 112 | active = (dir == NOUVEAU_THERM_THRS_RISING); |
@@ -123,7 +114,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm, | |||
123 | case NOUVEAU_THERM_THRS_FANBOOST: | 114 | case NOUVEAU_THERM_THRS_FANBOOST: |
124 | if (active) { | 115 | if (active) { |
125 | nouveau_therm_fan_set(therm, true, 100); | 116 | nouveau_therm_fan_set(therm, true, 100); |
126 | nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO); | 117 | nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO); |
127 | } | 118 | } |
128 | break; | 119 | break; |
129 | case NOUVEAU_THERM_THRS_DOWNCLOCK: | 120 | case NOUVEAU_THERM_THRS_DOWNCLOCK: |
@@ -202,7 +193,7 @@ alarm_timer_callback(struct nouveau_alarm *alarm) | |||
202 | NOUVEAU_THERM_THRS_SHUTDOWN); | 193 | NOUVEAU_THERM_THRS_SHUTDOWN); |
203 | 194 | ||
204 | /* schedule the next poll in one second */ | 195 | /* schedule the next poll in one second */ |
205 | if (list_empty(&alarm->head)) | 196 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) |
206 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); | 197 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); |
207 | 198 | ||
208 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | 199 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); |
@@ -225,6 +216,17 @@ nouveau_therm_program_alarms_polling(struct nouveau_therm *therm) | |||
225 | alarm_timer_callback(&priv->sensor.therm_poll_alarm); | 216 | alarm_timer_callback(&priv->sensor.therm_poll_alarm); |
226 | } | 217 | } |
227 | 218 | ||
219 | void | ||
220 | nouveau_therm_sensor_preinit(struct nouveau_therm *therm) | ||
221 | { | ||
222 | const char *sensor_avail = "yes"; | ||
223 | |||
224 | if (therm->temp_get(therm) < 0) | ||
225 | sensor_avail = "no"; | ||
226 | |||
227 | nv_info(therm, "internal sensor: %s\n", sensor_avail); | ||
228 | } | ||
229 | |||
228 | int | 230 | int |
229 | nouveau_therm_sensor_ctor(struct nouveau_therm *therm) | 231 | nouveau_therm_sensor_ctor(struct nouveau_therm *therm) |
230 | { | 232 | { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 41241922263f..5eb3e0da7c6e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
@@ -116,6 +116,11 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, | |||
116 | { | 116 | { |
117 | struct nouveau_abi16_ntfy *ntfy, *temp; | 117 | struct nouveau_abi16_ntfy *ntfy, *temp; |
118 | 118 | ||
119 | /* wait for all activity to stop before releasing notify object, which | ||
120 | * may be still in use */ | ||
121 | if (chan->chan && chan->ntfy) | ||
122 | nouveau_channel_idle(chan->chan); | ||
123 | |||
119 | /* cleanup notifier state */ | 124 | /* cleanup notifier state */ |
120 | list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) { | 125 | list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) { |
121 | nouveau_abi16_ntfy_fini(chan, ntfy); | 126 | nouveau_abi16_ntfy_fini(chan, ntfy); |
@@ -386,7 +391,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) | |||
386 | struct nouveau_drm *drm = nouveau_drm(dev); | 391 | struct nouveau_drm *drm = nouveau_drm(dev); |
387 | struct nouveau_device *device = nv_device(drm->device); | 392 | struct nouveau_device *device = nv_device(drm->device); |
388 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); | 393 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); |
389 | struct nouveau_abi16_chan *chan, *temp; | 394 | struct nouveau_abi16_chan *chan = NULL, *temp; |
390 | struct nouveau_abi16_ntfy *ntfy; | 395 | struct nouveau_abi16_ntfy *ntfy; |
391 | struct nouveau_object *object; | 396 | struct nouveau_object *object; |
392 | struct nv_dma_class args = {}; | 397 | struct nv_dma_class args = {}; |
@@ -399,10 +404,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) | |||
399 | if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) | 404 | if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) |
400 | return nouveau_abi16_put(abi16, -EINVAL); | 405 | return nouveau_abi16_put(abi16, -EINVAL); |
401 | 406 | ||
402 | list_for_each_entry_safe(chan, temp, &abi16->channels, head) { | 407 | list_for_each_entry(temp, &abi16->channels, head) { |
403 | if (chan->chan->handle == (NVDRM_CHAN | info->channel)) | 408 | if (temp->chan->handle == (NVDRM_CHAN | info->channel)) { |
409 | chan = temp; | ||
404 | break; | 410 | break; |
405 | chan = NULL; | 411 | } |
406 | } | 412 | } |
407 | 413 | ||
408 | if (!chan) | 414 | if (!chan) |
@@ -454,17 +460,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS) | |||
454 | { | 460 | { |
455 | struct drm_nouveau_gpuobj_free *fini = data; | 461 | struct drm_nouveau_gpuobj_free *fini = data; |
456 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); | 462 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); |
457 | struct nouveau_abi16_chan *chan, *temp; | 463 | struct nouveau_abi16_chan *chan = NULL, *temp; |
458 | struct nouveau_abi16_ntfy *ntfy; | 464 | struct nouveau_abi16_ntfy *ntfy; |
459 | int ret; | 465 | int ret; |
460 | 466 | ||
461 | if (unlikely(!abi16)) | 467 | if (unlikely(!abi16)) |
462 | return -ENOMEM; | 468 | return -ENOMEM; |
463 | 469 | ||
464 | list_for_each_entry_safe(chan, temp, &abi16->channels, head) { | 470 | list_for_each_entry(temp, &abi16->channels, head) { |
465 | if (chan->chan->handle == (NVDRM_CHAN | fini->channel)) | 471 | if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) { |
472 | chan = temp; | ||
466 | break; | 473 | break; |
467 | chan = NULL; | 474 | } |
468 | } | 475 | } |
469 | 476 | ||
470 | if (!chan) | 477 | if (!chan) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 11ca82148edc..7ff10711a4d0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -801,7 +801,7 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
801 | stride = 16 * 4; | 801 | stride = 16 * 4; |
802 | height = amount / stride; | 802 | height = amount / stride; |
803 | 803 | ||
804 | if (new_mem->mem_type == TTM_PL_VRAM && | 804 | if (old_mem->mem_type == TTM_PL_VRAM && |
805 | nouveau_bo_tile_layout(nvbo)) { | 805 | nouveau_bo_tile_layout(nvbo)) { |
806 | ret = RING_SPACE(chan, 8); | 806 | ret = RING_SPACE(chan, 8); |
807 | if (ret) | 807 | if (ret) |
@@ -823,7 +823,7 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
823 | BEGIN_NV04(chan, NvSubCopy, 0x0200, 1); | 823 | BEGIN_NV04(chan, NvSubCopy, 0x0200, 1); |
824 | OUT_RING (chan, 1); | 824 | OUT_RING (chan, 1); |
825 | } | 825 | } |
826 | if (old_mem->mem_type == TTM_PL_VRAM && | 826 | if (new_mem->mem_type == TTM_PL_VRAM && |
827 | nouveau_bo_tile_layout(nvbo)) { | 827 | nouveau_bo_tile_layout(nvbo)) { |
828 | ret = RING_SPACE(chan, 8); | 828 | ret = RING_SPACE(chan, 8); |
829 | if (ret) | 829 | if (ret) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index d1099365bfc1..c95decf543e9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -72,11 +72,25 @@ module_param_named(modeset, nouveau_modeset, int, 0400); | |||
72 | static struct drm_driver driver; | 72 | static struct drm_driver driver; |
73 | 73 | ||
74 | static int | 74 | static int |
75 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | ||
76 | { | ||
77 | struct nouveau_drm *drm = | ||
78 | container_of(event, struct nouveau_drm, vblank[head]); | ||
79 | drm_handle_vblank(drm->dev, head); | ||
80 | return NVKM_EVENT_KEEP; | ||
81 | } | ||
82 | |||
83 | static int | ||
75 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) | 84 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) |
76 | { | 85 | { |
77 | struct nouveau_drm *drm = nouveau_drm(dev); | 86 | struct nouveau_drm *drm = nouveau_drm(dev); |
78 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
79 | nouveau_event_get(pdisp->vblank, head, &drm->vblank); | 88 | |
89 | if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank))) | ||
90 | return -EIO; | ||
91 | WARN_ON_ONCE(drm->vblank[head].func); | ||
92 | drm->vblank[head].func = nouveau_drm_vblank_handler; | ||
93 | nouveau_event_get(pdisp->vblank, head, &drm->vblank[head]); | ||
80 | return 0; | 94 | return 0; |
81 | } | 95 | } |
82 | 96 | ||
@@ -85,16 +99,11 @@ nouveau_drm_vblank_disable(struct drm_device *dev, int head) | |||
85 | { | 99 | { |
86 | struct nouveau_drm *drm = nouveau_drm(dev); | 100 | struct nouveau_drm *drm = nouveau_drm(dev); |
87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 101 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
88 | nouveau_event_put(pdisp->vblank, head, &drm->vblank); | 102 | if (drm->vblank[head].func) |
89 | } | 103 | nouveau_event_put(pdisp->vblank, head, &drm->vblank[head]); |
90 | 104 | else | |
91 | static int | 105 | WARN_ON_ONCE(1); |
92 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | 106 | drm->vblank[head].func = NULL; |
93 | { | ||
94 | struct nouveau_drm *drm = | ||
95 | container_of(event, struct nouveau_drm, vblank); | ||
96 | drm_handle_vblank(drm->dev, head); | ||
97 | return NVKM_EVENT_KEEP; | ||
98 | } | 107 | } |
99 | 108 | ||
100 | static u64 | 109 | static u64 |
@@ -292,7 +301,6 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) | |||
292 | 301 | ||
293 | dev->dev_private = drm; | 302 | dev->dev_private = drm; |
294 | drm->dev = dev; | 303 | drm->dev = dev; |
295 | drm->vblank.func = nouveau_drm_vblank_handler; | ||
296 | 304 | ||
297 | INIT_LIST_HEAD(&drm->clients); | 305 | INIT_LIST_HEAD(&drm->clients); |
298 | spin_lock_init(&drm->tile.lock); | 306 | spin_lock_init(&drm->tile.lock); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index b25df374c901..9c39bafbef2c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -113,7 +113,7 @@ struct nouveau_drm { | |||
113 | struct nvbios vbios; | 113 | struct nvbios vbios; |
114 | struct nouveau_display *display; | 114 | struct nouveau_display *display; |
115 | struct backlight_device *backlight; | 115 | struct backlight_device *backlight; |
116 | struct nouveau_eventh vblank; | 116 | struct nouveau_eventh vblank[4]; |
117 | 117 | ||
118 | /* power management */ | 118 | /* power management */ |
119 | struct nouveau_pm *pm; | 119 | struct nouveau_pm *pm; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index bb54098c6d97..936b442a6ab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -402,8 +402,12 @@ nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) | |||
402 | struct drm_device *dev = dev_get_drvdata(d); | 402 | struct drm_device *dev = dev_get_drvdata(d); |
403 | struct nouveau_drm *drm = nouveau_drm(dev); | 403 | struct nouveau_drm *drm = nouveau_drm(dev); |
404 | struct nouveau_therm *therm = nouveau_therm(drm->device); | 404 | struct nouveau_therm *therm = nouveau_therm(drm->device); |
405 | int temp = therm->temp_get(therm); | ||
405 | 406 | ||
406 | return snprintf(buf, PAGE_SIZE, "%d\n", therm->temp_get(therm) * 1000); | 407 | if (temp < 0) |
408 | return temp; | ||
409 | |||
410 | return snprintf(buf, PAGE_SIZE, "%d\n", temp * 1000); | ||
407 | } | 411 | } |
408 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, | 412 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, |
409 | NULL, 0); | 413 | NULL, 0); |
@@ -871,7 +875,12 @@ static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO | S_IWUSR, | |||
871 | nouveau_hwmon_get_pwm1_max, | 875 | nouveau_hwmon_get_pwm1_max, |
872 | nouveau_hwmon_set_pwm1_max, 0); | 876 | nouveau_hwmon_set_pwm1_max, 0); |
873 | 877 | ||
874 | static struct attribute *hwmon_attributes[] = { | 878 | static struct attribute *hwmon_default_attributes[] = { |
879 | &sensor_dev_attr_name.dev_attr.attr, | ||
880 | &sensor_dev_attr_update_rate.dev_attr.attr, | ||
881 | NULL | ||
882 | }; | ||
883 | static struct attribute *hwmon_temp_attributes[] = { | ||
875 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 884 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
876 | &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, | 885 | &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, |
877 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | 886 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, |
@@ -882,8 +891,6 @@ static struct attribute *hwmon_attributes[] = { | |||
882 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | 891 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, |
883 | &sensor_dev_attr_temp1_emergency.dev_attr.attr, | 892 | &sensor_dev_attr_temp1_emergency.dev_attr.attr, |
884 | &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, | 893 | &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, |
885 | &sensor_dev_attr_name.dev_attr.attr, | ||
886 | &sensor_dev_attr_update_rate.dev_attr.attr, | ||
887 | NULL | 894 | NULL |
888 | }; | 895 | }; |
889 | static struct attribute *hwmon_fan_rpm_attributes[] = { | 896 | static struct attribute *hwmon_fan_rpm_attributes[] = { |
@@ -898,8 +905,11 @@ static struct attribute *hwmon_pwm_fan_attributes[] = { | |||
898 | NULL | 905 | NULL |
899 | }; | 906 | }; |
900 | 907 | ||
901 | static const struct attribute_group hwmon_attrgroup = { | 908 | static const struct attribute_group hwmon_default_attrgroup = { |
902 | .attrs = hwmon_attributes, | 909 | .attrs = hwmon_default_attributes, |
910 | }; | ||
911 | static const struct attribute_group hwmon_temp_attrgroup = { | ||
912 | .attrs = hwmon_temp_attributes, | ||
903 | }; | 913 | }; |
904 | static const struct attribute_group hwmon_fan_rpm_attrgroup = { | 914 | static const struct attribute_group hwmon_fan_rpm_attrgroup = { |
905 | .attrs = hwmon_fan_rpm_attributes, | 915 | .attrs = hwmon_fan_rpm_attributes, |
@@ -931,13 +941,22 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
931 | } | 941 | } |
932 | dev_set_drvdata(hwmon_dev, dev); | 942 | dev_set_drvdata(hwmon_dev, dev); |
933 | 943 | ||
934 | /* default sysfs entries */ | 944 | /* set the default attributes */ |
935 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_attrgroup); | 945 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_default_attrgroup); |
936 | if (ret) { | 946 | if (ret) { |
937 | if (ret) | 947 | if (ret) |
938 | goto error; | 948 | goto error; |
939 | } | 949 | } |
940 | 950 | ||
951 | /* if the card has a working thermal sensor */ | ||
952 | if (therm->temp_get(therm) >= 0) { | ||
953 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup); | ||
954 | if (ret) { | ||
955 | if (ret) | ||
956 | goto error; | ||
957 | } | ||
958 | } | ||
959 | |||
941 | /* if the card has a pwm fan */ | 960 | /* if the card has a pwm fan */ |
942 | /*XXX: incorrect, need better detection for this, some boards have | 961 | /*XXX: incorrect, need better detection for this, some boards have |
943 | * the gpio entries for pwm fan control even when there's no | 962 | * the gpio entries for pwm fan control even when there's no |
@@ -979,11 +998,10 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
979 | struct nouveau_pm *pm = nouveau_pm(dev); | 998 | struct nouveau_pm *pm = nouveau_pm(dev); |
980 | 999 | ||
981 | if (pm->hwmon) { | 1000 | if (pm->hwmon) { |
982 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 1001 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_default_attrgroup); |
983 | sysfs_remove_group(&pm->hwmon->kobj, | 1002 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_temp_attrgroup); |
984 | &hwmon_pwm_fan_attrgroup); | 1003 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_pwm_fan_attrgroup); |
985 | sysfs_remove_group(&pm->hwmon->kobj, | 1004 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_fan_rpm_attrgroup); |
986 | &hwmon_fan_rpm_attrgroup); | ||
987 | 1005 | ||
988 | hwmon_device_unregister(pm->hwmon); | 1006 | hwmon_device_unregister(pm->hwmon); |
989 | } | 1007 | } |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 87a5a56ed358..1ddc03e51bf4 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -479,7 +479,7 @@ nv50_display_flip_wait(void *data) | |||
479 | { | 479 | { |
480 | struct nv50_display_flip *flip = data; | 480 | struct nv50_display_flip *flip = data; |
481 | if (nouveau_bo_rd32(flip->disp->sync, flip->chan->addr / 4) == | 481 | if (nouveau_bo_rd32(flip->disp->sync, flip->chan->addr / 4) == |
482 | flip->chan->data); | 482 | flip->chan->data) |
483 | return true; | 483 | return true; |
484 | usleep_range(1, 2); | 484 | usleep_range(1, 2); |
485 | return false; | 485 | return false; |
@@ -524,6 +524,8 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
524 | swap_interval <<= 4; | 524 | swap_interval <<= 4; |
525 | if (swap_interval == 0) | 525 | if (swap_interval == 0) |
526 | swap_interval |= 0x100; | 526 | swap_interval |= 0x100; |
527 | if (chan == NULL) | ||
528 | evo_sync(crtc->dev); | ||
527 | 529 | ||
528 | push = evo_wait(sync, 128); | 530 | push = evo_wait(sync, 128); |
529 | if (unlikely(push == NULL)) | 531 | if (unlikely(push == NULL)) |
@@ -586,8 +588,6 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
586 | sync->addr ^= 0x10; | 588 | sync->addr ^= 0x10; |
587 | sync->data++; | 589 | sync->data++; |
588 | FIRE_RING (chan); | 590 | FIRE_RING (chan); |
589 | } else { | ||
590 | evo_sync(crtc->dev); | ||
591 | } | 591 | } |
592 | 592 | ||
593 | /* queue the flip */ | 593 | /* queue the flip */ |
@@ -2276,6 +2276,7 @@ nv50_display_create(struct drm_device *dev) | |||
2276 | NV_WARN(drm, "failed to create encoder %d/%d/%d: %d\n", | 2276 | NV_WARN(drm, "failed to create encoder %d/%d/%d: %d\n", |
2277 | dcbe->location, dcbe->type, | 2277 | dcbe->location, dcbe->type, |
2278 | ffs(dcbe->or) - 1, ret); | 2278 | ffs(dcbe->or) - 1, ret); |
2279 | ret = 0; | ||
2279 | } | 2280 | } |
2280 | } | 2281 | } |
2281 | 2282 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index d4c633e12863..27769e724b6d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -468,13 +468,19 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
468 | (rdev->pdev->device == 0x9907) || | 468 | (rdev->pdev->device == 0x9907) || |
469 | (rdev->pdev->device == 0x9908) || | 469 | (rdev->pdev->device == 0x9908) || |
470 | (rdev->pdev->device == 0x9909) || | 470 | (rdev->pdev->device == 0x9909) || |
471 | (rdev->pdev->device == 0x990B) || | ||
472 | (rdev->pdev->device == 0x990C) || | ||
473 | (rdev->pdev->device == 0x990F) || | ||
471 | (rdev->pdev->device == 0x9910) || | 474 | (rdev->pdev->device == 0x9910) || |
472 | (rdev->pdev->device == 0x9917)) { | 475 | (rdev->pdev->device == 0x9917) || |
476 | (rdev->pdev->device == 0x9999)) { | ||
473 | rdev->config.cayman.max_simds_per_se = 6; | 477 | rdev->config.cayman.max_simds_per_se = 6; |
474 | rdev->config.cayman.max_backends_per_se = 2; | 478 | rdev->config.cayman.max_backends_per_se = 2; |
475 | } else if ((rdev->pdev->device == 0x9903) || | 479 | } else if ((rdev->pdev->device == 0x9903) || |
476 | (rdev->pdev->device == 0x9904) || | 480 | (rdev->pdev->device == 0x9904) || |
477 | (rdev->pdev->device == 0x990A) || | 481 | (rdev->pdev->device == 0x990A) || |
482 | (rdev->pdev->device == 0x990D) || | ||
483 | (rdev->pdev->device == 0x990E) || | ||
478 | (rdev->pdev->device == 0x9913) || | 484 | (rdev->pdev->device == 0x9913) || |
479 | (rdev->pdev->device == 0x9918)) { | 485 | (rdev->pdev->device == 0x9918)) { |
480 | rdev->config.cayman.max_simds_per_se = 4; | 486 | rdev->config.cayman.max_simds_per_se = 4; |
@@ -483,6 +489,9 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
483 | (rdev->pdev->device == 0x9990) || | 489 | (rdev->pdev->device == 0x9990) || |
484 | (rdev->pdev->device == 0x9991) || | 490 | (rdev->pdev->device == 0x9991) || |
485 | (rdev->pdev->device == 0x9994) || | 491 | (rdev->pdev->device == 0x9994) || |
492 | (rdev->pdev->device == 0x9995) || | ||
493 | (rdev->pdev->device == 0x9996) || | ||
494 | (rdev->pdev->device == 0x999A) || | ||
486 | (rdev->pdev->device == 0x99A0)) { | 495 | (rdev->pdev->device == 0x99A0)) { |
487 | rdev->config.cayman.max_simds_per_se = 3; | 496 | rdev->config.cayman.max_simds_per_se = 3; |
488 | rdev->config.cayman.max_backends_per_se = 1; | 497 | rdev->config.cayman.max_backends_per_se = 1; |
@@ -616,11 +625,22 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
616 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); | 625 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); |
617 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); | 626 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); |
618 | 627 | ||
619 | tmp = gb_addr_config & NUM_PIPES_MASK; | 628 | if ((rdev->config.cayman.max_backends_per_se == 1) && |
620 | tmp = r6xx_remap_render_backend(rdev, tmp, | 629 | (rdev->flags & RADEON_IS_IGP)) { |
621 | rdev->config.cayman.max_backends_per_se * | 630 | if ((disabled_rb_mask & 3) == 1) { |
622 | rdev->config.cayman.max_shader_engines, | 631 | /* RB0 disabled, RB1 enabled */ |
623 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | 632 | tmp = 0x11111111; |
633 | } else { | ||
634 | /* RB1 disabled, RB0 enabled */ | ||
635 | tmp = 0x00000000; | ||
636 | } | ||
637 | } else { | ||
638 | tmp = gb_addr_config & NUM_PIPES_MASK; | ||
639 | tmp = r6xx_remap_render_backend(rdev, tmp, | ||
640 | rdev->config.cayman.max_backends_per_se * | ||
641 | rdev->config.cayman.max_shader_engines, | ||
642 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | ||
643 | } | ||
624 | WREG32(GB_BACKEND_MAP, tmp); | 644 | WREG32(GB_BACKEND_MAP, tmp); |
625 | 645 | ||
626 | cgts_tcc_disable = 0xffff0000; | 646 | cgts_tcc_disable = 0xffff0000; |
@@ -1771,6 +1791,7 @@ int cayman_resume(struct radeon_device *rdev) | |||
1771 | int cayman_suspend(struct radeon_device *rdev) | 1791 | int cayman_suspend(struct radeon_device *rdev) |
1772 | { | 1792 | { |
1773 | r600_audio_fini(rdev); | 1793 | r600_audio_fini(rdev); |
1794 | radeon_vm_manager_fini(rdev); | ||
1774 | cayman_cp_enable(rdev, false); | 1795 | cayman_cp_enable(rdev, false); |
1775 | cayman_dma_stop(rdev); | 1796 | cayman_dma_stop(rdev); |
1776 | evergreen_irq_suspend(rdev); | 1797 | evergreen_irq_suspend(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index bedda9caadd9..6e05a2e75a46 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c | |||
@@ -122,10 +122,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, | |||
122 | goto out_cleanup; | 122 | goto out_cleanup; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* r100 doesn't have dma engine so skip the test */ | 125 | if (rdev->asic->copy.dma) { |
126 | /* also, VRAM-to-VRAM test doesn't make much sense for DMA */ | ||
127 | /* skip it as well if domains are the same */ | ||
128 | if ((rdev->asic->copy.dma) && (sdomain != ddomain)) { | ||
129 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, | 126 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
130 | RADEON_BENCHMARK_COPY_DMA, n); | 127 | RADEON_BENCHMARK_COPY_DMA, n); |
131 | if (time < 0) | 128 | if (time < 0) |
@@ -135,13 +132,15 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, | |||
135 | sdomain, ddomain, "dma"); | 132 | sdomain, ddomain, "dma"); |
136 | } | 133 | } |
137 | 134 | ||
138 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, | 135 | if (rdev->asic->copy.blit) { |
139 | RADEON_BENCHMARK_COPY_BLIT, n); | 136 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
140 | if (time < 0) | 137 | RADEON_BENCHMARK_COPY_BLIT, n); |
141 | goto out_cleanup; | 138 | if (time < 0) |
142 | if (time > 0) | 139 | goto out_cleanup; |
143 | radeon_benchmark_log_results(n, size, time, | 140 | if (time > 0) |
144 | sdomain, ddomain, "blit"); | 141 | radeon_benchmark_log_results(n, size, time, |
142 | sdomain, ddomain, "blit"); | ||
143 | } | ||
145 | 144 | ||
146 | out_cleanup: | 145 | out_cleanup: |
147 | if (sobj) { | 146 | if (sobj) { |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index b8015913d382..fa3c56fba294 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -99,6 +99,29 @@ static bool radeon_read_bios(struct radeon_device *rdev) | |||
99 | return true; | 99 | return true; |
100 | } | 100 | } |
101 | 101 | ||
102 | static bool radeon_read_platform_bios(struct radeon_device *rdev) | ||
103 | { | ||
104 | uint8_t __iomem *bios; | ||
105 | size_t size; | ||
106 | |||
107 | rdev->bios = NULL; | ||
108 | |||
109 | bios = pci_platform_rom(rdev->pdev, &size); | ||
110 | if (!bios) { | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | ||
115 | return false; | ||
116 | } | ||
117 | rdev->bios = kmemdup(bios, size, GFP_KERNEL); | ||
118 | if (rdev->bios == NULL) { | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | return true; | ||
123 | } | ||
124 | |||
102 | #ifdef CONFIG_ACPI | 125 | #ifdef CONFIG_ACPI |
103 | /* ATRM is used to get the BIOS on the discrete cards in | 126 | /* ATRM is used to get the BIOS on the discrete cards in |
104 | * dual-gpu systems. | 127 | * dual-gpu systems. |
@@ -620,6 +643,9 @@ bool radeon_get_bios(struct radeon_device *rdev) | |||
620 | if (r == false) { | 643 | if (r == false) { |
621 | r = radeon_read_disabled_bios(rdev); | 644 | r = radeon_read_disabled_bios(rdev); |
622 | } | 645 | } |
646 | if (r == false) { | ||
647 | r = radeon_read_platform_bios(rdev); | ||
648 | } | ||
623 | if (r == false || rdev->bios == NULL) { | 649 | if (r == false || rdev->bios == NULL) { |
624 | DRM_ERROR("Unable to locate a BIOS ROM\n"); | 650 | DRM_ERROR("Unable to locate a BIOS ROM\n"); |
625 | rdev->bios = NULL; | 651 | rdev->bios = NULL; |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 9128120da044..bafbe3216952 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -4469,6 +4469,7 @@ int si_resume(struct radeon_device *rdev) | |||
4469 | 4469 | ||
4470 | int si_suspend(struct radeon_device *rdev) | 4470 | int si_suspend(struct radeon_device *rdev) |
4471 | { | 4471 | { |
4472 | radeon_vm_manager_fini(rdev); | ||
4472 | si_cp_enable(rdev, false); | 4473 | si_cp_enable(rdev, false); |
4473 | cayman_dma_stop(rdev); | 4474 | cayman_dma_stop(rdev); |
4474 | si_irq_suspend(rdev); | 4475 | si_irq_suspend(rdev); |
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c index fe5cdbcf2636..b44d548c56f8 100644 --- a/drivers/gpu/drm/udl/udl_connector.c +++ b/drivers/gpu/drm/udl/udl_connector.c | |||
@@ -61,6 +61,10 @@ static int udl_get_modes(struct drm_connector *connector) | |||
61 | int ret; | 61 | int ret; |
62 | 62 | ||
63 | edid = (struct edid *)udl_get_edid(udl); | 63 | edid = (struct edid *)udl_get_edid(udl); |
64 | if (!edid) { | ||
65 | drm_mode_connector_update_edid_property(connector, NULL); | ||
66 | return 0; | ||
67 | } | ||
64 | 68 | ||
65 | /* | 69 | /* |
66 | * We only read the main block, but if the monitor reports extension | 70 | * We only read the main block, but if the monitor reports extension |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 512b01c04ea7..aa341d135867 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
2077 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, | 2077 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
2078 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, | 2078 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
2079 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, | 2079 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, |
2080 | { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) }, | ||
2081 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | 2080 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
2082 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | 2081 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
2083 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | 2082 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
@@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev) | |||
2244 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) | 2243 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) |
2245 | return true; | 2244 | return true; |
2246 | break; | 2245 | break; |
2246 | case USB_VENDOR_ID_ATMEL_V_USB: | ||
2247 | /* Masterkit MA901 usb radio based on Atmel tiny85 chip and | ||
2248 | * it has the same USB ID as many Atmel V-USB devices. This | ||
2249 | * usb radio is handled by radio-ma901.c driver so we want | ||
2250 | * ignore the hid. Check the name, bus, product and ignore | ||
2251 | * if we have MA901 usb radio. | ||
2252 | */ | ||
2253 | if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && | ||
2254 | hdev->bus == BUS_USB && | ||
2255 | strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) | ||
2256 | return true; | ||
2257 | break; | ||
2247 | } | 2258 | } |
2248 | 2259 | ||
2249 | if (hdev->type == HID_TYPE_USBMOUSE && | 2260 | if (hdev->type == HID_TYPE_USBMOUSE && |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 92e47e5c9564..5309fd5eb0eb 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -158,6 +158,8 @@ | |||
158 | #define USB_VENDOR_ID_ATMEL 0x03eb | 158 | #define USB_VENDOR_ID_ATMEL 0x03eb |
159 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 159 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
160 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 | 160 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 |
161 | #define USB_VENDOR_ID_ATMEL_V_USB 0x16c0 | ||
162 | #define USB_DEVICE_ID_ATMEL_V_USB 0x05df | ||
161 | 163 | ||
162 | #define USB_VENDOR_ID_AUREAL 0x0755 | 164 | #define USB_VENDOR_ID_AUREAL 0x0755 |
163 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 | 165 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 |
@@ -557,9 +559,6 @@ | |||
557 | #define USB_VENDOR_ID_MADCATZ 0x0738 | 559 | #define USB_VENDOR_ID_MADCATZ 0x0738 |
558 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 | 560 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 |
559 | 561 | ||
560 | #define USB_VENDOR_ID_MASTERKIT 0x16c0 | ||
561 | #define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df | ||
562 | |||
563 | #define USB_VENDOR_ID_MCC 0x09db | 562 | #define USB_VENDOR_ID_MCC 0x09db |
564 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | 563 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
565 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | 564 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
@@ -590,6 +589,9 @@ | |||
590 | #define USB_VENDOR_ID_MONTEREY 0x0566 | 589 | #define USB_VENDOR_ID_MONTEREY 0x0566 |
591 | #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 | 590 | #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 |
592 | 591 | ||
592 | #define USB_VENDOR_ID_MSI 0x1770 | ||
593 | #define USB_DEVICE_ID_MSI_GX680R_LED_PANEL 0xff00 | ||
594 | |||
593 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | 595 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 |
594 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | 596 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 |
595 | 597 | ||
@@ -684,6 +686,9 @@ | |||
684 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001 | 686 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001 |
685 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 | 687 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 |
686 | 688 | ||
689 | #define USB_VENDOR_ID_REALTEK 0x0bda | ||
690 | #define USB_DEVICE_ID_REALTEK_READER 0x0152 | ||
691 | |||
687 | #define USB_VENDOR_ID_ROCCAT 0x1e7d | 692 | #define USB_VENDOR_ID_ROCCAT 0x1e7d |
688 | #define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4 | 693 | #define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4 |
689 | #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c | 694 | #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index f7f113ba083e..a8ce44296cfd 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev, | |||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||
465 | static void magicmouse_input_configured(struct hid_device *hdev, | ||
466 | struct hid_input *hi) | ||
467 | |||
468 | { | ||
469 | struct magicmouse_sc *msc = hid_get_drvdata(hdev); | ||
470 | |||
471 | int ret = magicmouse_setup_input(msc->input, hdev); | ||
472 | if (ret) { | ||
473 | hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); | ||
474 | /* clean msc->input to notify probe() of the failure */ | ||
475 | msc->input = NULL; | ||
476 | } | ||
477 | } | ||
478 | |||
479 | |||
465 | static int magicmouse_probe(struct hid_device *hdev, | 480 | static int magicmouse_probe(struct hid_device *hdev, |
466 | const struct hid_device_id *id) | 481 | const struct hid_device_id *id) |
467 | { | 482 | { |
@@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
493 | goto err_free; | 508 | goto err_free; |
494 | } | 509 | } |
495 | 510 | ||
496 | /* We do this after hid-input is done parsing reports so that | 511 | if (!msc->input) { |
497 | * hid-input uses the most natural button and axis IDs. | 512 | hid_err(hdev, "magicmouse input not registered\n"); |
498 | */ | 513 | ret = -ENOMEM; |
499 | if (msc->input) { | 514 | goto err_stop_hw; |
500 | ret = magicmouse_setup_input(msc->input, hdev); | ||
501 | if (ret) { | ||
502 | hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); | ||
503 | goto err_stop_hw; | ||
504 | } | ||
505 | } | 515 | } |
506 | 516 | ||
507 | if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) | 517 | if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) |
@@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = { | |||
568 | .remove = magicmouse_remove, | 578 | .remove = magicmouse_remove, |
569 | .raw_event = magicmouse_raw_event, | 579 | .raw_event = magicmouse_raw_event, |
570 | .input_mapping = magicmouse_input_mapping, | 580 | .input_mapping = magicmouse_input_mapping, |
581 | .input_configured = magicmouse_input_configured, | ||
571 | }; | 582 | }; |
572 | module_hid_driver(magicmouse_driver); | 583 | module_hid_driver(magicmouse_driver); |
573 | 584 | ||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 7a1ebb867cf4..82e9211b3ca9 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -621,6 +621,7 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
621 | { | 621 | { |
622 | struct mt_device *td = hid_get_drvdata(hid); | 622 | struct mt_device *td = hid_get_drvdata(hid); |
623 | __s32 quirks = td->mtclass.quirks; | 623 | __s32 quirks = td->mtclass.quirks; |
624 | struct input_dev *input = field->hidinput->input; | ||
624 | 625 | ||
625 | if (hid->claimed & HID_CLAIMED_INPUT) { | 626 | if (hid->claimed & HID_CLAIMED_INPUT) { |
626 | switch (usage->hid) { | 627 | switch (usage->hid) { |
@@ -670,13 +671,16 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
670 | break; | 671 | break; |
671 | 672 | ||
672 | default: | 673 | default: |
674 | if (usage->type) | ||
675 | input_event(input, usage->type, usage->code, | ||
676 | value); | ||
673 | return; | 677 | return; |
674 | } | 678 | } |
675 | 679 | ||
676 | if (usage->usage_index + 1 == field->report_count) { | 680 | if (usage->usage_index + 1 == field->report_count) { |
677 | /* we only take into account the last report. */ | 681 | /* we only take into account the last report. */ |
678 | if (usage->hid == td->last_slot_field) | 682 | if (usage->hid == td->last_slot_field) |
679 | mt_complete_slot(td, field->hidinput->input); | 683 | mt_complete_slot(td, input); |
680 | 684 | ||
681 | if (field->index == td->last_field_index | 685 | if (field->index == td->last_field_index |
682 | && td->num_received >= td->num_expected) | 686 | && td->num_received >= td->num_expected) |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index e0e6abf1cd3b..19b8360f2330 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -73,6 +73,7 @@ static const struct hid_blacklist { | |||
73 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 73 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
74 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 74 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
75 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | 75 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, |
76 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, | ||
76 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, | 77 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, |
77 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, | 78 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, |
78 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, | 79 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, |
@@ -80,6 +81,7 @@ static const struct hid_blacklist { | |||
80 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, | 81 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, |
81 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET }, | 82 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET }, |
82 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, | 83 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, |
84 | { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS }, | ||
83 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, | 85 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, |
84 | { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, | 86 | { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, |
85 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 87 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c index 41df29f59b0e..ebbb9f4f27a3 100644 --- a/drivers/hwmon/lineage-pem.c +++ b/drivers/hwmon/lineage-pem.c | |||
@@ -422,6 +422,7 @@ static struct attribute *pem_input_attributes[] = { | |||
422 | &sensor_dev_attr_in2_input.dev_attr.attr, | 422 | &sensor_dev_attr_in2_input.dev_attr.attr, |
423 | &sensor_dev_attr_curr1_input.dev_attr.attr, | 423 | &sensor_dev_attr_curr1_input.dev_attr.attr, |
424 | &sensor_dev_attr_power1_input.dev_attr.attr, | 424 | &sensor_dev_attr_power1_input.dev_attr.attr, |
425 | NULL | ||
425 | }; | 426 | }; |
426 | 427 | ||
427 | static const struct attribute_group pem_input_group = { | 428 | static const struct attribute_group pem_input_group = { |
@@ -432,6 +433,7 @@ static struct attribute *pem_fan_attributes[] = { | |||
432 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 433 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
433 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 434 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
434 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 435 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
436 | NULL | ||
435 | }; | 437 | }; |
436 | 438 | ||
437 | static const struct attribute_group pem_fan_group = { | 439 | static const struct attribute_group pem_fan_group = { |
diff --git a/drivers/hwmon/lm75.h b/drivers/hwmon/lm75.h index 668ff4721323..5cde94e56f17 100644 --- a/drivers/hwmon/lm75.h +++ b/drivers/hwmon/lm75.h | |||
@@ -25,7 +25,7 @@ | |||
25 | which contains this code, we don't worry about the wasted space. | 25 | which contains this code, we don't worry about the wasted space. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/hwmon.h> | 28 | #include <linux/kernel.h> |
29 | 29 | ||
30 | /* straight from the datasheet */ | 30 | /* straight from the datasheet */ |
31 | #define LM75_TEMP_MIN (-55000) | 31 | #define LM75_TEMP_MIN (-55000) |
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index a58de38e23d8..6d6130752f94 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c | |||
@@ -59,7 +59,7 @@ enum chips { ltc2978, ltc3880 }; | |||
59 | struct ltc2978_data { | 59 | struct ltc2978_data { |
60 | enum chips id; | 60 | enum chips id; |
61 | int vin_min, vin_max; | 61 | int vin_min, vin_max; |
62 | int temp_min, temp_max; | 62 | int temp_min, temp_max[2]; |
63 | int vout_min[8], vout_max[8]; | 63 | int vout_min[8], vout_max[8]; |
64 | int iout_max[2]; | 64 | int iout_max[2]; |
65 | int temp2_max; | 65 | int temp2_max; |
@@ -113,9 +113,10 @@ static int ltc2978_read_word_data_common(struct i2c_client *client, int page, | |||
113 | ret = pmbus_read_word_data(client, page, | 113 | ret = pmbus_read_word_data(client, page, |
114 | LTC2978_MFR_TEMPERATURE_PEAK); | 114 | LTC2978_MFR_TEMPERATURE_PEAK); |
115 | if (ret >= 0) { | 115 | if (ret >= 0) { |
116 | if (lin11_to_val(ret) > lin11_to_val(data->temp_max)) | 116 | if (lin11_to_val(ret) |
117 | data->temp_max = ret; | 117 | > lin11_to_val(data->temp_max[page])) |
118 | ret = data->temp_max; | 118 | data->temp_max[page] = ret; |
119 | ret = data->temp_max[page]; | ||
119 | } | 120 | } |
120 | break; | 121 | break; |
121 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | 122 | case PMBUS_VIRT_RESET_VOUT_HISTORY: |
@@ -266,7 +267,7 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | |||
266 | break; | 267 | break; |
267 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | 268 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
268 | data->temp_min = 0x7bff; | 269 | data->temp_min = 0x7bff; |
269 | data->temp_max = 0x7c00; | 270 | data->temp_max[page] = 0x7c00; |
270 | ret = ltc2978_clear_peaks(client, page, data->id); | 271 | ret = ltc2978_clear_peaks(client, page, data->id); |
271 | break; | 272 | break; |
272 | default: | 273 | default: |
@@ -323,7 +324,8 @@ static int ltc2978_probe(struct i2c_client *client, | |||
323 | data->vin_min = 0x7bff; | 324 | data->vin_min = 0x7bff; |
324 | data->vin_max = 0x7c00; | 325 | data->vin_max = 0x7c00; |
325 | data->temp_min = 0x7bff; | 326 | data->temp_min = 0x7bff; |
326 | data->temp_max = 0x7c00; | 327 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) |
328 | data->temp_max[i] = 0x7c00; | ||
327 | data->temp2_max = 0x7c00; | 329 | data->temp2_max = 0x7c00; |
328 | 330 | ||
329 | switch (data->id) { | 331 | switch (data->id) { |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 80eef50c50fd..9add60920ac0 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -766,12 +766,14 @@ static ssize_t pmbus_show_label(struct device *dev, | |||
766 | static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) | 766 | static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) |
767 | { | 767 | { |
768 | if (data->num_attributes >= data->max_attributes - 1) { | 768 | if (data->num_attributes >= data->max_attributes - 1) { |
769 | data->max_attributes += PMBUS_ATTR_ALLOC_SIZE; | 769 | int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE; |
770 | data->group.attrs = krealloc(data->group.attrs, | 770 | void *new_attrs = krealloc(data->group.attrs, |
771 | sizeof(struct attribute *) * | 771 | new_max_attrs * sizeof(void *), |
772 | data->max_attributes, GFP_KERNEL); | 772 | GFP_KERNEL); |
773 | if (data->group.attrs == NULL) | 773 | if (!new_attrs) |
774 | return -ENOMEM; | 774 | return -ENOMEM; |
775 | data->group.attrs = new_attrs; | ||
776 | data->max_attributes = new_max_attrs; | ||
775 | } | 777 | } |
776 | 778 | ||
777 | data->group.attrs[data->num_attributes++] = attr; | 779 | data->group.attrs[data->num_attributes++] = attr; |
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index db713c0dfba4..461a0d739d75 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
@@ -416,6 +416,8 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) | |||
416 | ret = pm_runtime_get_sync(dev); | 416 | ret = pm_runtime_get_sync(dev); |
417 | if (ret < 0) { | 417 | if (ret < 0) { |
418 | dev_err(dev, "%s: can't power on device\n", __func__); | 418 | dev_err(dev, "%s: can't power on device\n", __func__); |
419 | pm_runtime_put_noidle(dev); | ||
420 | module_put(dev->driver->owner); | ||
419 | return ret; | 421 | return ret; |
420 | } | 422 | } |
421 | 423 | ||
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 46cde098c11c..e380c6eef3af 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig I2C | 5 | menuconfig I2C |
6 | tristate "I2C support" | 6 | tristate "I2C support" |
7 | depends on !S390 | ||
8 | select RT_MUTEXES | 7 | select RT_MUTEXES |
9 | ---help--- | 8 | ---help--- |
10 | I2C (pronounce: I-squared-C) is a slow serial bus protocol used in | 9 | I2C (pronounce: I-squared-C) is a slow serial bus protocol used in |
@@ -76,6 +75,7 @@ config I2C_HELPER_AUTO | |||
76 | 75 | ||
77 | config I2C_SMBUS | 76 | config I2C_SMBUS |
78 | tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO | 77 | tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO |
78 | depends on GENERIC_HARDIRQS | ||
79 | help | 79 | help |
80 | Say Y here if you want support for SMBus extensions to the I2C | 80 | Say Y here if you want support for SMBus extensions to the I2C |
81 | specification. At the moment, the only supported extension is | 81 | specification. At the moment, the only supported extension is |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index a3725de92384..adfee98486b1 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -114,7 +114,7 @@ config I2C_I801 | |||
114 | 114 | ||
115 | config I2C_ISCH | 115 | config I2C_ISCH |
116 | tristate "Intel SCH SMBus 1.0" | 116 | tristate "Intel SCH SMBus 1.0" |
117 | depends on PCI | 117 | depends on PCI && GENERIC_HARDIRQS |
118 | select LPC_SCH | 118 | select LPC_SCH |
119 | help | 119 | help |
120 | Say Y here if you want to use SMBus controller on the Intel SCH | 120 | Say Y here if you want to use SMBus controller on the Intel SCH |
@@ -543,6 +543,7 @@ config I2C_NUC900 | |||
543 | 543 | ||
544 | config I2C_OCORES | 544 | config I2C_OCORES |
545 | tristate "OpenCores I2C Controller" | 545 | tristate "OpenCores I2C Controller" |
546 | depends on GENERIC_HARDIRQS | ||
546 | help | 547 | help |
547 | If you say yes to this option, support will be included for the | 548 | If you say yes to this option, support will be included for the |
548 | OpenCores I2C controller. For details see | 549 | OpenCores I2C controller. For details see |
@@ -777,7 +778,7 @@ config I2C_DIOLAN_U2C | |||
777 | 778 | ||
778 | config I2C_PARPORT | 779 | config I2C_PARPORT |
779 | tristate "Parallel port adapter" | 780 | tristate "Parallel port adapter" |
780 | depends on PARPORT | 781 | depends on PARPORT && GENERIC_HARDIRQS |
781 | select I2C_ALGOBIT | 782 | select I2C_ALGOBIT |
782 | select I2C_SMBUS | 783 | select I2C_SMBUS |
783 | help | 784 | help |
@@ -802,6 +803,7 @@ config I2C_PARPORT | |||
802 | 803 | ||
803 | config I2C_PARPORT_LIGHT | 804 | config I2C_PARPORT_LIGHT |
804 | tristate "Parallel port adapter (light)" | 805 | tristate "Parallel port adapter (light)" |
806 | depends on GENERIC_HARDIRQS | ||
805 | select I2C_ALGOBIT | 807 | select I2C_ALGOBIT |
806 | select I2C_SMBUS | 808 | select I2C_SMBUS |
807 | help | 809 | help |
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 0ceb6e1b0f65..e3085c487ace 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -182,7 +182,6 @@ static int dw_i2c_probe(struct platform_device *pdev) | |||
182 | adap->algo = &i2c_dw_algo; | 182 | adap->algo = &i2c_dw_algo; |
183 | adap->dev.parent = &pdev->dev; | 183 | adap->dev.parent = &pdev->dev; |
184 | adap->dev.of_node = pdev->dev.of_node; | 184 | adap->dev.of_node = pdev->dev.of_node; |
185 | ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev)); | ||
186 | 185 | ||
187 | r = i2c_add_numbered_adapter(adap); | 186 | r = i2c_add_numbered_adapter(adap); |
188 | if (r) { | 187 | if (r) { |
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index e9205ee8cf94..130f02cc9d94 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -80,6 +80,7 @@ | |||
80 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ | 80 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ |
81 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 | 81 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 |
82 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a | 82 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a |
83 | #define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15 | ||
83 | 84 | ||
84 | #define ISMT_DESC_ENTRIES 32 /* number of descriptor entries */ | 85 | #define ISMT_DESC_ENTRIES 32 /* number of descriptor entries */ |
85 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ | 86 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ |
@@ -185,6 +186,7 @@ struct ismt_priv { | |||
185 | static const DEFINE_PCI_DEVICE_TABLE(ismt_ids) = { | 186 | static const DEFINE_PCI_DEVICE_TABLE(ismt_ids) = { |
186 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, | 187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, |
187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, | 188 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, |
189 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_AVOTON_SMT) }, | ||
188 | { 0, } | 190 | { 0, } |
189 | }; | 191 | }; |
190 | 192 | ||
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 36704e3ab3fa..b714776b6ddd 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -411,7 +411,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
411 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | 411 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; |
412 | u32 clk_divisor; | 412 | u32 clk_divisor; |
413 | 413 | ||
414 | tegra_i2c_clock_enable(i2c_dev); | 414 | err = tegra_i2c_clock_enable(i2c_dev); |
415 | if (err < 0) { | ||
416 | dev_err(i2c_dev->dev, "Clock enable failed %d\n", err); | ||
417 | return err; | ||
418 | } | ||
415 | 419 | ||
416 | tegra_periph_reset_assert(i2c_dev->div_clk); | 420 | tegra_periph_reset_assert(i2c_dev->div_clk); |
417 | udelay(2); | 421 | udelay(2); |
@@ -628,7 +632,12 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], | |||
628 | if (i2c_dev->is_suspended) | 632 | if (i2c_dev->is_suspended) |
629 | return -EBUSY; | 633 | return -EBUSY; |
630 | 634 | ||
631 | tegra_i2c_clock_enable(i2c_dev); | 635 | ret = tegra_i2c_clock_enable(i2c_dev); |
636 | if (ret < 0) { | ||
637 | dev_err(i2c_dev->dev, "Clock enable failed %d\n", ret); | ||
638 | return ret; | ||
639 | } | ||
640 | |||
632 | for (i = 0; i < num; i++) { | 641 | for (i = 0; i < num; i++) { |
633 | enum msg_end_type end_type = MSG_END_STOP; | 642 | enum msg_end_type end_type = MSG_END_STOP; |
634 | if (i < (num - 1)) { | 643 | if (i < (num - 1)) { |
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index f3b8f9a6a89b..966a18a5d12d 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2010 Ericsson AB. | 4 | * Copyright (c) 2010 Ericsson AB. |
5 | * | 5 | * |
6 | * Author: Guenter Roeck <guenter.roeck@ericsson.com> | 6 | * Author: Guenter Roeck <linux@roeck-us.net> |
7 | * | 7 | * |
8 | * Derived from: | 8 | * Derived from: |
9 | * pca954x.c | 9 | * pca954x.c |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 5d6675013864..1a38dd7dfe4e 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -465,6 +465,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { | |||
465 | ICPU(0x3c, idle_cpu_hsw), | 465 | ICPU(0x3c, idle_cpu_hsw), |
466 | ICPU(0x3f, idle_cpu_hsw), | 466 | ICPU(0x3f, idle_cpu_hsw), |
467 | ICPU(0x45, idle_cpu_hsw), | 467 | ICPU(0x45, idle_cpu_hsw), |
468 | ICPU(0x46, idle_cpu_hsw), | ||
468 | {} | 469 | {} |
469 | }; | 470 | }; |
470 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); | 471 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); |
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 0198324a8b0c..bd33473f8e38 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -62,7 +62,7 @@ st_sensors_match_odr_error: | |||
62 | int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) | 62 | int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) |
63 | { | 63 | { |
64 | int err; | 64 | int err; |
65 | struct st_sensor_odr_avl odr_out; | 65 | struct st_sensor_odr_avl odr_out = {0, 0}; |
66 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 66 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
67 | 67 | ||
68 | err = st_sensors_match_odr(sdata->sensor, odr, &odr_out); | 68 | err = st_sensors_match_odr(sdata->sensor, odr, &odr_out); |
@@ -114,7 +114,7 @@ st_sensors_match_odr_error: | |||
114 | 114 | ||
115 | static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs) | 115 | static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs) |
116 | { | 116 | { |
117 | int err, i; | 117 | int err, i = 0; |
118 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 118 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
119 | 119 | ||
120 | err = st_sensors_match_fs(sdata->sensor, fs, &i); | 120 | err = st_sensors_match_fs(sdata->sensor, fs, &i); |
@@ -139,14 +139,13 @@ st_accel_set_fullscale_error: | |||
139 | 139 | ||
140 | int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable) | 140 | int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable) |
141 | { | 141 | { |
142 | bool found; | ||
143 | u8 tmp_value; | 142 | u8 tmp_value; |
144 | int err = -EINVAL; | 143 | int err = -EINVAL; |
145 | struct st_sensor_odr_avl odr_out; | 144 | bool found = false; |
145 | struct st_sensor_odr_avl odr_out = {0, 0}; | ||
146 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 146 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
147 | 147 | ||
148 | if (enable) { | 148 | if (enable) { |
149 | found = false; | ||
150 | tmp_value = sdata->sensor->pw.value_on; | 149 | tmp_value = sdata->sensor->pw.value_on; |
151 | if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) && | 150 | if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) && |
152 | (sdata->sensor->odr.mask == sdata->sensor->pw.mask)) { | 151 | (sdata->sensor->odr.mask == sdata->sensor->pw.mask)) { |
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index 2fe1d4edcb2f..74f2d52795f6 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #define AD5064_ADDR(x) ((x) << 20) | 27 | #define AD5064_ADDR(x) ((x) << 20) |
28 | #define AD5064_CMD(x) ((x) << 24) | 28 | #define AD5064_CMD(x) ((x) << 24) |
29 | 29 | ||
30 | #define AD5064_ADDR_DAC(chan) (chan) | ||
31 | #define AD5064_ADDR_ALL_DAC 0xF | 30 | #define AD5064_ADDR_ALL_DAC 0xF |
32 | 31 | ||
33 | #define AD5064_CMD_WRITE_INPUT_N 0x0 | 32 | #define AD5064_CMD_WRITE_INPUT_N 0x0 |
@@ -131,15 +130,15 @@ static int ad5064_write(struct ad5064_state *st, unsigned int cmd, | |||
131 | } | 130 | } |
132 | 131 | ||
133 | static int ad5064_sync_powerdown_mode(struct ad5064_state *st, | 132 | static int ad5064_sync_powerdown_mode(struct ad5064_state *st, |
134 | unsigned int channel) | 133 | const struct iio_chan_spec *chan) |
135 | { | 134 | { |
136 | unsigned int val; | 135 | unsigned int val; |
137 | int ret; | 136 | int ret; |
138 | 137 | ||
139 | val = (0x1 << channel); | 138 | val = (0x1 << chan->address); |
140 | 139 | ||
141 | if (st->pwr_down[channel]) | 140 | if (st->pwr_down[chan->channel]) |
142 | val |= st->pwr_down_mode[channel] << 8; | 141 | val |= st->pwr_down_mode[chan->channel] << 8; |
143 | 142 | ||
144 | ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); | 143 | ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); |
145 | 144 | ||
@@ -169,7 +168,7 @@ static int ad5064_set_powerdown_mode(struct iio_dev *indio_dev, | |||
169 | mutex_lock(&indio_dev->mlock); | 168 | mutex_lock(&indio_dev->mlock); |
170 | st->pwr_down_mode[chan->channel] = mode + 1; | 169 | st->pwr_down_mode[chan->channel] = mode + 1; |
171 | 170 | ||
172 | ret = ad5064_sync_powerdown_mode(st, chan->channel); | 171 | ret = ad5064_sync_powerdown_mode(st, chan); |
173 | mutex_unlock(&indio_dev->mlock); | 172 | mutex_unlock(&indio_dev->mlock); |
174 | 173 | ||
175 | return ret; | 174 | return ret; |
@@ -205,7 +204,7 @@ static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev, | |||
205 | mutex_lock(&indio_dev->mlock); | 204 | mutex_lock(&indio_dev->mlock); |
206 | st->pwr_down[chan->channel] = pwr_down; | 205 | st->pwr_down[chan->channel] = pwr_down; |
207 | 206 | ||
208 | ret = ad5064_sync_powerdown_mode(st, chan->channel); | 207 | ret = ad5064_sync_powerdown_mode(st, chan); |
209 | mutex_unlock(&indio_dev->mlock); | 208 | mutex_unlock(&indio_dev->mlock); |
210 | return ret ? ret : len; | 209 | return ret ? ret : len; |
211 | } | 210 | } |
@@ -258,7 +257,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev, | |||
258 | 257 | ||
259 | switch (mask) { | 258 | switch (mask) { |
260 | case IIO_CHAN_INFO_RAW: | 259 | case IIO_CHAN_INFO_RAW: |
261 | if (val > (1 << chan->scan_type.realbits) || val < 0) | 260 | if (val >= (1 << chan->scan_type.realbits) || val < 0) |
262 | return -EINVAL; | 261 | return -EINVAL; |
263 | 262 | ||
264 | mutex_lock(&indio_dev->mlock); | 263 | mutex_lock(&indio_dev->mlock); |
@@ -292,34 +291,44 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { | |||
292 | { }, | 291 | { }, |
293 | }; | 292 | }; |
294 | 293 | ||
295 | #define AD5064_CHANNEL(chan, bits) { \ | 294 | #define AD5064_CHANNEL(chan, addr, bits) { \ |
296 | .type = IIO_VOLTAGE, \ | 295 | .type = IIO_VOLTAGE, \ |
297 | .indexed = 1, \ | 296 | .indexed = 1, \ |
298 | .output = 1, \ | 297 | .output = 1, \ |
299 | .channel = (chan), \ | 298 | .channel = (chan), \ |
300 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 299 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ |
301 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ | 300 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ |
302 | .address = AD5064_ADDR_DAC(chan), \ | 301 | .address = addr, \ |
303 | .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ | 302 | .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ |
304 | .ext_info = ad5064_ext_info, \ | 303 | .ext_info = ad5064_ext_info, \ |
305 | } | 304 | } |
306 | 305 | ||
307 | #define DECLARE_AD5064_CHANNELS(name, bits) \ | 306 | #define DECLARE_AD5064_CHANNELS(name, bits) \ |
308 | const struct iio_chan_spec name[] = { \ | 307 | const struct iio_chan_spec name[] = { \ |
309 | AD5064_CHANNEL(0, bits), \ | 308 | AD5064_CHANNEL(0, 0, bits), \ |
310 | AD5064_CHANNEL(1, bits), \ | 309 | AD5064_CHANNEL(1, 1, bits), \ |
311 | AD5064_CHANNEL(2, bits), \ | 310 | AD5064_CHANNEL(2, 2, bits), \ |
312 | AD5064_CHANNEL(3, bits), \ | 311 | AD5064_CHANNEL(3, 3, bits), \ |
313 | AD5064_CHANNEL(4, bits), \ | 312 | AD5064_CHANNEL(4, 4, bits), \ |
314 | AD5064_CHANNEL(5, bits), \ | 313 | AD5064_CHANNEL(5, 5, bits), \ |
315 | AD5064_CHANNEL(6, bits), \ | 314 | AD5064_CHANNEL(6, 6, bits), \ |
316 | AD5064_CHANNEL(7, bits), \ | 315 | AD5064_CHANNEL(7, 7, bits), \ |
316 | } | ||
317 | |||
318 | #define DECLARE_AD5065_CHANNELS(name, bits) \ | ||
319 | const struct iio_chan_spec name[] = { \ | ||
320 | AD5064_CHANNEL(0, 0, bits), \ | ||
321 | AD5064_CHANNEL(1, 3, bits), \ | ||
317 | } | 322 | } |
318 | 323 | ||
319 | static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); | 324 | static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); |
320 | static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); | 325 | static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); |
321 | static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); | 326 | static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); |
322 | 327 | ||
328 | static DECLARE_AD5065_CHANNELS(ad5025_channels, 12); | ||
329 | static DECLARE_AD5065_CHANNELS(ad5045_channels, 14); | ||
330 | static DECLARE_AD5065_CHANNELS(ad5065_channels, 16); | ||
331 | |||
323 | static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | 332 | static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { |
324 | [ID_AD5024] = { | 333 | [ID_AD5024] = { |
325 | .shared_vref = false, | 334 | .shared_vref = false, |
@@ -328,7 +337,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
328 | }, | 337 | }, |
329 | [ID_AD5025] = { | 338 | [ID_AD5025] = { |
330 | .shared_vref = false, | 339 | .shared_vref = false, |
331 | .channels = ad5024_channels, | 340 | .channels = ad5025_channels, |
332 | .num_channels = 2, | 341 | .num_channels = 2, |
333 | }, | 342 | }, |
334 | [ID_AD5044] = { | 343 | [ID_AD5044] = { |
@@ -338,7 +347,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
338 | }, | 347 | }, |
339 | [ID_AD5045] = { | 348 | [ID_AD5045] = { |
340 | .shared_vref = false, | 349 | .shared_vref = false, |
341 | .channels = ad5044_channels, | 350 | .channels = ad5045_channels, |
342 | .num_channels = 2, | 351 | .num_channels = 2, |
343 | }, | 352 | }, |
344 | [ID_AD5064] = { | 353 | [ID_AD5064] = { |
@@ -353,7 +362,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
353 | }, | 362 | }, |
354 | [ID_AD5065] = { | 363 | [ID_AD5065] = { |
355 | .shared_vref = false, | 364 | .shared_vref = false, |
356 | .channels = ad5064_channels, | 365 | .channels = ad5065_channels, |
357 | .num_channels = 2, | 366 | .num_channels = 2, |
358 | }, | 367 | }, |
359 | [ID_AD5628_1] = { | 368 | [ID_AD5628_1] = { |
@@ -429,6 +438,7 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type, | |||
429 | { | 438 | { |
430 | struct iio_dev *indio_dev; | 439 | struct iio_dev *indio_dev; |
431 | struct ad5064_state *st; | 440 | struct ad5064_state *st; |
441 | unsigned int midscale; | ||
432 | unsigned int i; | 442 | unsigned int i; |
433 | int ret; | 443 | int ret; |
434 | 444 | ||
@@ -465,11 +475,6 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type, | |||
465 | goto error_free_reg; | 475 | goto error_free_reg; |
466 | } | 476 | } |
467 | 477 | ||
468 | for (i = 0; i < st->chip_info->num_channels; ++i) { | ||
469 | st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K; | ||
470 | st->dac_cache[i] = 0x8000; | ||
471 | } | ||
472 | |||
473 | indio_dev->dev.parent = dev; | 478 | indio_dev->dev.parent = dev; |
474 | indio_dev->name = name; | 479 | indio_dev->name = name; |
475 | indio_dev->info = &ad5064_info; | 480 | indio_dev->info = &ad5064_info; |
@@ -477,6 +482,13 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type, | |||
477 | indio_dev->channels = st->chip_info->channels; | 482 | indio_dev->channels = st->chip_info->channels; |
478 | indio_dev->num_channels = st->chip_info->num_channels; | 483 | indio_dev->num_channels = st->chip_info->num_channels; |
479 | 484 | ||
485 | midscale = (1 << indio_dev->channels[0].scan_type.realbits) / 2; | ||
486 | |||
487 | for (i = 0; i < st->chip_info->num_channels; ++i) { | ||
488 | st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K; | ||
489 | st->dac_cache[i] = midscale; | ||
490 | } | ||
491 | |||
480 | ret = iio_device_register(indio_dev); | 492 | ret = iio_device_register(indio_dev); |
481 | if (ret) | 493 | if (ret) |
482 | goto error_disable_reg; | 494 | goto error_disable_reg; |
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig index b5cfa3a354cf..361b2328453d 100644 --- a/drivers/iio/imu/inv_mpu6050/Kconfig +++ b/drivers/iio/imu/inv_mpu6050/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config INV_MPU6050_IIO | 5 | config INV_MPU6050_IIO |
6 | tristate "Invensense MPU6050 devices" | 6 | tristate "Invensense MPU6050 devices" |
7 | depends on I2C && SYSFS | 7 | depends on I2C && SYSFS |
8 | select IIO_BUFFER | ||
8 | select IIO_TRIGGERED_BUFFER | 9 | select IIO_TRIGGERED_BUFFER |
9 | help | 10 | help |
10 | This driver supports the Invensense MPU6050 devices. | 11 | This driver supports the Invensense MPU6050 devices. |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 565bfb161c1a..a3fde52840ca 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1575,6 +1575,12 @@ static int c4iw_reconnect(struct c4iw_ep *ep) | |||
1575 | 1575 | ||
1576 | neigh = dst_neigh_lookup(ep->dst, | 1576 | neigh = dst_neigh_lookup(ep->dst, |
1577 | &ep->com.cm_id->remote_addr.sin_addr.s_addr); | 1577 | &ep->com.cm_id->remote_addr.sin_addr.s_addr); |
1578 | if (!neigh) { | ||
1579 | pr_err("%s - cannot alloc neigh.\n", __func__); | ||
1580 | err = -ENOMEM; | ||
1581 | goto fail4; | ||
1582 | } | ||
1583 | |||
1578 | /* get a l2t entry */ | 1584 | /* get a l2t entry */ |
1579 | if (neigh->dev->flags & IFF_LOOPBACK) { | 1585 | if (neigh->dev->flags & IFF_LOOPBACK) { |
1580 | PDBG("%s LOOPBACK\n", __func__); | 1586 | PDBG("%s LOOPBACK\n", __func__); |
@@ -3053,6 +3059,12 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) | |||
3053 | dst = &rt->dst; | 3059 | dst = &rt->dst; |
3054 | neigh = dst_neigh_lookup_skb(dst, skb); | 3060 | neigh = dst_neigh_lookup_skb(dst, skb); |
3055 | 3061 | ||
3062 | if (!neigh) { | ||
3063 | pr_err("%s - failed to allocate neigh!\n", | ||
3064 | __func__); | ||
3065 | goto free_dst; | ||
3066 | } | ||
3067 | |||
3056 | if (neigh->dev->flags & IFF_LOOPBACK) { | 3068 | if (neigh->dev->flags & IFF_LOOPBACK) { |
3057 | pdev = ip_dev_find(&init_net, iph->daddr); | 3069 | pdev = ip_dev_find(&init_net, iph->daddr); |
3058 | e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, | 3070 | e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 17ba4f8bc12d..70b1808a08f4 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -186,8 +186,10 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, | |||
186 | wq->rq.queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), | 186 | wq->rq.queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), |
187 | wq->rq.memsize, &(wq->rq.dma_addr), | 187 | wq->rq.memsize, &(wq->rq.dma_addr), |
188 | GFP_KERNEL); | 188 | GFP_KERNEL); |
189 | if (!wq->rq.queue) | 189 | if (!wq->rq.queue) { |
190 | ret = -ENOMEM; | ||
190 | goto free_sq; | 191 | goto free_sq; |
192 | } | ||
191 | PDBG("%s sq base va 0x%p pa 0x%llx rq base va 0x%p pa 0x%llx\n", | 193 | PDBG("%s sq base va 0x%p pa 0x%llx rq base va 0x%p pa 0x%llx\n", |
192 | __func__, wq->sq.queue, | 194 | __func__, wq->sq.queue, |
193 | (unsigned long long)virt_to_phys(wq->sq.queue), | 195 | (unsigned long long)virt_to_phys(wq->sq.queue), |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 439c35d4a669..ea93870266eb 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -620,7 +620,7 @@ void ipath_ib_rcv(struct ipath_ibdev *dev, void *rhdr, void *data, | |||
620 | goto bail; | 620 | goto bail; |
621 | } | 621 | } |
622 | 622 | ||
623 | opcode = be32_to_cpu(ohdr->bth[0]) >> 24; | 623 | opcode = (be32_to_cpu(ohdr->bth[0]) >> 24) & 0x7f; |
624 | dev->opstats[opcode].n_bytes += tlen; | 624 | dev->opstats[opcode].n_bytes += tlen; |
625 | dev->opstats[opcode].n_packets++; | 625 | dev->opstats[opcode].n_packets++; |
626 | 626 | ||
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c index e0d79b2395e4..add98d01476c 100644 --- a/drivers/infiniband/hw/mlx4/cm.c +++ b/drivers/infiniband/hw/mlx4/cm.c | |||
@@ -362,7 +362,6 @@ void mlx4_ib_cm_paravirt_init(struct mlx4_ib_dev *dev) | |||
362 | INIT_LIST_HEAD(&dev->sriov.cm_list); | 362 | INIT_LIST_HEAD(&dev->sriov.cm_list); |
363 | dev->sriov.sl_id_map = RB_ROOT; | 363 | dev->sriov.sl_id_map = RB_ROOT; |
364 | idr_init(&dev->sriov.pv_id_table); | 364 | idr_init(&dev->sriov.pv_id_table); |
365 | idr_pre_get(&dev->sriov.pv_id_table, GFP_KERNEL); | ||
366 | } | 365 | } |
367 | 366 | ||
368 | /* slave = -1 ==> all slaves */ | 367 | /* slave = -1 ==> all slaves */ |
diff --git a/drivers/infiniband/hw/qib/Kconfig b/drivers/infiniband/hw/qib/Kconfig index 8349f9c5064c..1e603a375069 100644 --- a/drivers/infiniband/hw/qib/Kconfig +++ b/drivers/infiniband/hw/qib/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config INFINIBAND_QIB | 1 | config INFINIBAND_QIB |
2 | tristate "QLogic PCIe HCA support" | 2 | tristate "Intel PCIe HCA support" |
3 | depends on 64BIT | 3 | depends on 64BIT |
4 | ---help--- | 4 | ---help--- |
5 | This is a low-level driver for QLogic PCIe QLE InfiniBand host | 5 | This is a low-level driver for Intel PCIe QLE InfiniBand host |
6 | channel adapters. This driver does not support the QLogic | 6 | channel adapters. This driver does not support the Intel |
7 | HyperTransport card (model QHT7140). | 7 | HyperTransport card (model QHT7140). |
diff --git a/drivers/infiniband/hw/qib/qib_driver.c b/drivers/infiniband/hw/qib/qib_driver.c index 5423edcab51f..216092477dfc 100644 --- a/drivers/infiniband/hw/qib/qib_driver.c +++ b/drivers/infiniband/hw/qib/qib_driver.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013 Intel Corporation. All rights reserved. | ||
2 | * Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved. |
3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
4 | * | 5 | * |
@@ -63,8 +64,8 @@ MODULE_PARM_DESC(compat_ddr_negotiate, | |||
63 | "Attempt pre-IBTA 1.2 DDR speed negotiation"); | 64 | "Attempt pre-IBTA 1.2 DDR speed negotiation"); |
64 | 65 | ||
65 | MODULE_LICENSE("Dual BSD/GPL"); | 66 | MODULE_LICENSE("Dual BSD/GPL"); |
66 | MODULE_AUTHOR("QLogic <support@qlogic.com>"); | 67 | MODULE_AUTHOR("Intel <ibsupport@intel.com>"); |
67 | MODULE_DESCRIPTION("QLogic IB driver"); | 68 | MODULE_DESCRIPTION("Intel IB driver"); |
68 | MODULE_VERSION(QIB_DRIVER_VERSION); | 69 | MODULE_VERSION(QIB_DRIVER_VERSION); |
69 | 70 | ||
70 | /* | 71 | /* |
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index a099ac171e22..0232ae56b1fa 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013 Intel Corporation. All rights reserved. | ||
2 | * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. | 3 | * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. |
3 | * All rights reserved. | 4 | * All rights reserved. |
4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 5 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
@@ -51,7 +52,7 @@ static u32 qib_6120_iblink_state(u64); | |||
51 | 52 | ||
52 | /* | 53 | /* |
53 | * This file contains all the chip-specific register information and | 54 | * This file contains all the chip-specific register information and |
54 | * access functions for the QLogic QLogic_IB PCI-Express chip. | 55 | * access functions for the Intel Intel_IB PCI-Express chip. |
55 | * | 56 | * |
56 | */ | 57 | */ |
57 | 58 | ||
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index 50e33aa0b4e3..173f805790da 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
5 | * | 5 | * |
@@ -1138,7 +1138,7 @@ void qib_disable_after_error(struct qib_devdata *dd) | |||
1138 | static void qib_remove_one(struct pci_dev *); | 1138 | static void qib_remove_one(struct pci_dev *); |
1139 | static int qib_init_one(struct pci_dev *, const struct pci_device_id *); | 1139 | static int qib_init_one(struct pci_dev *, const struct pci_device_id *); |
1140 | 1140 | ||
1141 | #define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: " | 1141 | #define DRIVER_LOAD_MSG "Intel " QIB_DRV_NAME " loaded: " |
1142 | #define PFX QIB_DRV_NAME ": " | 1142 | #define PFX QIB_DRV_NAME ": " |
1143 | 1143 | ||
1144 | static DEFINE_PCI_DEVICE_TABLE(qib_pci_tbl) = { | 1144 | static DEFINE_PCI_DEVICE_TABLE(qib_pci_tbl) = { |
@@ -1355,7 +1355,7 @@ static int qib_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1355 | dd = qib_init_iba6120_funcs(pdev, ent); | 1355 | dd = qib_init_iba6120_funcs(pdev, ent); |
1356 | #else | 1356 | #else |
1357 | qib_early_err(&pdev->dev, | 1357 | qib_early_err(&pdev->dev, |
1358 | "QLogic PCIE device 0x%x cannot work if CONFIG_PCI_MSI is not enabled\n", | 1358 | "Intel PCIE device 0x%x cannot work if CONFIG_PCI_MSI is not enabled\n", |
1359 | ent->device); | 1359 | ent->device); |
1360 | dd = ERR_PTR(-ENODEV); | 1360 | dd = ERR_PTR(-ENODEV); |
1361 | #endif | 1361 | #endif |
@@ -1371,7 +1371,7 @@ static int qib_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1371 | 1371 | ||
1372 | default: | 1372 | default: |
1373 | qib_early_err(&pdev->dev, | 1373 | qib_early_err(&pdev->dev, |
1374 | "Failing on unknown QLogic deviceid 0x%x\n", | 1374 | "Failing on unknown Intel deviceid 0x%x\n", |
1375 | ent->device); | 1375 | ent->device); |
1376 | ret = -ENODEV; | 1376 | ret = -ENODEV; |
1377 | } | 1377 | } |
diff --git a/drivers/infiniband/hw/qib/qib_sd7220.c b/drivers/infiniband/hw/qib/qib_sd7220.c index 50a8a0d4fe67..911205d3d5a0 100644 --- a/drivers/infiniband/hw/qib/qib_sd7220.c +++ b/drivers/infiniband/hw/qib/qib_sd7220.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2013 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
5 | * | 5 | * |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c index ba51a4715a1d..7c0ab16a2fe2 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.c +++ b/drivers/infiniband/hw/qib/qib_verbs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
4 | * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. |
5 | * | 5 | * |
@@ -2224,7 +2224,7 @@ int qib_register_ib_device(struct qib_devdata *dd) | |||
2224 | ibdev->dma_ops = &qib_dma_mapping_ops; | 2224 | ibdev->dma_ops = &qib_dma_mapping_ops; |
2225 | 2225 | ||
2226 | snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), | 2226 | snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), |
2227 | "QLogic Infiniband HCA %s", init_utsname()->nodename); | 2227 | "Intel Infiniband HCA %s", init_utsname()->nodename); |
2228 | 2228 | ||
2229 | ret = ib_register_device(ibdev, qib_create_port_files); | 2229 | ret = ib_register_device(ibdev, qib_create_port_files); |
2230 | if (ret) | 2230 | if (ret) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 67b0c1d23678..1ef880de3a41 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -758,9 +758,13 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ | |||
758 | if (++priv->tx_outstanding == ipoib_sendq_size) { | 758 | if (++priv->tx_outstanding == ipoib_sendq_size) { |
759 | ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", | 759 | ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", |
760 | tx->qp->qp_num); | 760 | tx->qp->qp_num); |
761 | if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP)) | ||
762 | ipoib_warn(priv, "request notify on send CQ failed\n"); | ||
763 | netif_stop_queue(dev); | 761 | netif_stop_queue(dev); |
762 | rc = ib_req_notify_cq(priv->send_cq, | ||
763 | IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS); | ||
764 | if (rc < 0) | ||
765 | ipoib_warn(priv, "request notify on send CQ failed\n"); | ||
766 | else if (rc) | ||
767 | ipoib_send_comp_handler(priv->send_cq, dev); | ||
764 | } | 768 | } |
765 | } | 769 | } |
766 | } | 770 | } |
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 7cd74e29cbc8..9135606c8649 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c | |||
@@ -158,14 +158,10 @@ static unsigned int get_time_pit(void) | |||
158 | #define GET_TIME(x) rdtscl(x) | 158 | #define GET_TIME(x) rdtscl(x) |
159 | #define DELTA(x,y) ((y)-(x)) | 159 | #define DELTA(x,y) ((y)-(x)) |
160 | #define TIME_NAME "TSC" | 160 | #define TIME_NAME "TSC" |
161 | #elif defined(__alpha__) | 161 | #elif defined(__alpha__) || defined(CONFIG_MN10300) || defined(CONFIG_ARM) || defined(CONFIG_TILE) |
162 | #define GET_TIME(x) do { x = get_cycles(); } while (0) | 162 | #define GET_TIME(x) do { x = get_cycles(); } while (0) |
163 | #define DELTA(x,y) ((y)-(x)) | 163 | #define DELTA(x,y) ((y)-(x)) |
164 | #define TIME_NAME "PCC" | 164 | #define TIME_NAME "get_cycles" |
165 | #elif defined(CONFIG_MN10300) || defined(CONFIG_TILE) | ||
166 | #define GET_TIME(x) do { x = get_cycles(); } while (0) | ||
167 | #define DELTA(x, y) ((x) - (y)) | ||
168 | #define TIME_NAME "TSC" | ||
169 | #else | 165 | #else |
170 | #define FAKE_TIME | 166 | #define FAKE_TIME |
171 | static unsigned long analog_faketime = 0; | 167 | static unsigned long analog_faketime = 0; |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 1daa97913b7d..0bfd8cf25200 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -359,7 +359,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
359 | case 0x802: /* Intuos4 General Pen */ | 359 | case 0x802: /* Intuos4 General Pen */ |
360 | case 0x804: /* Intuos4 Marker Pen */ | 360 | case 0x804: /* Intuos4 Marker Pen */ |
361 | case 0x40802: /* Intuos4 Classic Pen */ | 361 | case 0x40802: /* Intuos4 Classic Pen */ |
362 | case 0x18803: /* DTH2242 Grip Pen */ | 362 | case 0x18802: /* DTH2242 Grip Pen */ |
363 | case 0x022: | 363 | case 0x022: |
364 | wacom->tool[idx] = BTN_TOOL_PEN; | 364 | wacom->tool[idx] = BTN_TOOL_PEN; |
365 | break; | 365 | break; |
@@ -1912,7 +1912,7 @@ static const struct wacom_features wacom_features_0xBB = | |||
1912 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, | 1912 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, |
1913 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1913 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1914 | static const struct wacom_features wacom_features_0xBC = | 1914 | static const struct wacom_features wacom_features_0xBC = |
1915 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, | 1915 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40640, 25400, 2047, |
1916 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1916 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1917 | static const struct wacom_features wacom_features_0x26 = | 1917 | static const struct wacom_features wacom_features_0x26 = |
1918 | { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | 1918 | { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, |
@@ -2144,7 +2144,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2144 | { USB_DEVICE_WACOM(0x44) }, | 2144 | { USB_DEVICE_WACOM(0x44) }, |
2145 | { USB_DEVICE_WACOM(0x45) }, | 2145 | { USB_DEVICE_WACOM(0x45) }, |
2146 | { USB_DEVICE_WACOM(0x59) }, | 2146 | { USB_DEVICE_WACOM(0x59) }, |
2147 | { USB_DEVICE_WACOM(0x5D) }, | 2147 | { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) }, |
2148 | { USB_DEVICE_WACOM(0xB0) }, | 2148 | { USB_DEVICE_WACOM(0xB0) }, |
2149 | { USB_DEVICE_WACOM(0xB1) }, | 2149 | { USB_DEVICE_WACOM(0xB1) }, |
2150 | { USB_DEVICE_WACOM(0xB2) }, | 2150 | { USB_DEVICE_WACOM(0xB2) }, |
@@ -2209,7 +2209,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2209 | { USB_DEVICE_WACOM(0x47) }, | 2209 | { USB_DEVICE_WACOM(0x47) }, |
2210 | { USB_DEVICE_WACOM(0xF4) }, | 2210 | { USB_DEVICE_WACOM(0xF4) }, |
2211 | { USB_DEVICE_WACOM(0xF8) }, | 2211 | { USB_DEVICE_WACOM(0xF8) }, |
2212 | { USB_DEVICE_WACOM(0xF6) }, | 2212 | { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) }, |
2213 | { USB_DEVICE_WACOM(0xFA) }, | 2213 | { USB_DEVICE_WACOM(0xFA) }, |
2214 | { USB_DEVICE_LENOVO(0x6004) }, | 2214 | { USB_DEVICE_LENOVO(0x6004) }, |
2215 | { } | 2215 | { } |
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 5c514d0711d1..c332fb98480d 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig | |||
@@ -130,7 +130,7 @@ config IRQ_REMAP | |||
130 | # OMAP IOMMU support | 130 | # OMAP IOMMU support |
131 | config OMAP_IOMMU | 131 | config OMAP_IOMMU |
132 | bool "OMAP IOMMU Support" | 132 | bool "OMAP IOMMU Support" |
133 | depends on ARCH_OMAP | 133 | depends on ARCH_OMAP2PLUS |
134 | select IOMMU_API | 134 | select IOMMU_API |
135 | 135 | ||
136 | config OMAP_IOVMM | 136 | config OMAP_IOVMM |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 98f555dafb55..b287ca33833d 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2466,18 +2466,16 @@ static int device_change_notifier(struct notifier_block *nb, | |||
2466 | 2466 | ||
2467 | /* allocate a protection domain if a device is added */ | 2467 | /* allocate a protection domain if a device is added */ |
2468 | dma_domain = find_protection_domain(devid); | 2468 | dma_domain = find_protection_domain(devid); |
2469 | if (dma_domain) | 2469 | if (!dma_domain) { |
2470 | goto out; | 2470 | dma_domain = dma_ops_domain_alloc(); |
2471 | dma_domain = dma_ops_domain_alloc(); | 2471 | if (!dma_domain) |
2472 | if (!dma_domain) | 2472 | goto out; |
2473 | goto out; | 2473 | dma_domain->target_dev = devid; |
2474 | dma_domain->target_dev = devid; | 2474 | |
2475 | 2475 | spin_lock_irqsave(&iommu_pd_list_lock, flags); | |
2476 | spin_lock_irqsave(&iommu_pd_list_lock, flags); | 2476 | list_add_tail(&dma_domain->list, &iommu_pd_list); |
2477 | list_add_tail(&dma_domain->list, &iommu_pd_list); | 2477 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); |
2478 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); | 2478 | } |
2479 | |||
2480 | dev_data = get_dev_data(dev); | ||
2481 | 2479 | ||
2482 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | 2480 | dev->archdata.dma_ops = &amd_iommu_dma_ops; |
2483 | 2481 | ||
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index b6ecddb63cd0..e3c2d74b7684 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -980,7 +980,7 @@ static void __init free_iommu_all(void) | |||
980 | * BIOS should disable L2B micellaneous clock gating by setting | 980 | * BIOS should disable L2B micellaneous clock gating by setting |
981 | * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b | 981 | * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b |
982 | */ | 982 | */ |
983 | static void __init amd_iommu_erratum_746_workaround(struct amd_iommu *iommu) | 983 | static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu) |
984 | { | 984 | { |
985 | u32 value; | 985 | u32 value; |
986 | 986 | ||
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c index d56f8c17c5fe..7c11ff368d07 100644 --- a/drivers/iommu/irq_remapping.c +++ b/drivers/iommu/irq_remapping.c | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <linux/cpumask.h> | 2 | #include <linux/cpumask.h> |
3 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
4 | #include <linux/string.h> | 4 | #include <linux/string.h> |
5 | #include <linux/cpumask.h> | ||
6 | #include <linux/errno.h> | 5 | #include <linux/errno.h> |
7 | #include <linux/msi.h> | 6 | #include <linux/msi.h> |
8 | #include <linux/irq.h> | 7 | #include <linux/irq.h> |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 644d72468423..fc6aebf1e4b2 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -236,7 +236,8 @@ static int gic_retrigger(struct irq_data *d) | |||
236 | if (gic_arch_extn.irq_retrigger) | 236 | if (gic_arch_extn.irq_retrigger) |
237 | return gic_arch_extn.irq_retrigger(d); | 237 | return gic_arch_extn.irq_retrigger(d); |
238 | 238 | ||
239 | return -ENXIO; | 239 | /* the genirq layer expects 0 if we can't retrigger in hardware */ |
240 | return 0; | ||
240 | } | 241 | } |
241 | 242 | ||
242 | #ifdef CONFIG_SMP | 243 | #ifdef CONFIG_SMP |
@@ -648,7 +649,7 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq) | |||
648 | 649 | ||
649 | /* Convert our logical CPU mask into a physical one. */ | 650 | /* Convert our logical CPU mask into a physical one. */ |
650 | for_each_cpu(cpu, mask) | 651 | for_each_cpu(cpu, mask) |
651 | map |= 1 << cpu_logical_map(cpu); | 652 | map |= gic_cpu_map[cpu]; |
652 | 653 | ||
653 | /* | 654 | /* |
654 | * Ensure that stores to Normal memory are visible to the | 655 | * Ensure that stores to Normal memory are visible to the |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index 5313c9ea44dc..d9edcc94c2a8 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -237,7 +237,8 @@ config HISAX_MIC | |||
237 | 237 | ||
238 | config HISAX_NETJET | 238 | config HISAX_NETJET |
239 | bool "NETjet card" | 239 | bool "NETjet card" |
240 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) | 240 | depends on PCI && (BROKEN || !(PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) |
241 | depends on VIRT_TO_BUS | ||
241 | help | 242 | help |
242 | This enables HiSax support for the NetJet from Traverse | 243 | This enables HiSax support for the NetJet from Traverse |
243 | Technologies. | 244 | Technologies. |
@@ -248,7 +249,8 @@ config HISAX_NETJET | |||
248 | 249 | ||
249 | config HISAX_NETJET_U | 250 | config HISAX_NETJET_U |
250 | bool "NETspider U card" | 251 | bool "NETspider U card" |
251 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) | 252 | depends on PCI && (BROKEN || !(PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) |
253 | depends on VIRT_TO_BUS | ||
252 | help | 254 | help |
253 | This enables HiSax support for the Netspider U interface ISDN card | 255 | This enables HiSax support for the Netspider U interface ISDN card |
254 | from Traverse Technologies. | 256 | from Traverse Technologies. |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 3c955e10a618..c6083132c4b8 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1025,6 +1025,8 @@ void dm_bufio_prefetch(struct dm_bufio_client *c, | |||
1025 | { | 1025 | { |
1026 | struct blk_plug plug; | 1026 | struct blk_plug plug; |
1027 | 1027 | ||
1028 | BUG_ON(dm_bufio_in_request()); | ||
1029 | |||
1028 | blk_start_plug(&plug); | 1030 | blk_start_plug(&plug); |
1029 | dm_bufio_lock(c); | 1031 | dm_bufio_lock(c); |
1030 | 1032 | ||
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index fbd3625f2748..83e995fece88 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
@@ -83,6 +83,8 @@ struct cache_disk_superblock { | |||
83 | __le32 read_misses; | 83 | __le32 read_misses; |
84 | __le32 write_hits; | 84 | __le32 write_hits; |
85 | __le32 write_misses; | 85 | __le32 write_misses; |
86 | |||
87 | __le32 policy_version[CACHE_POLICY_VERSION_SIZE]; | ||
86 | } __packed; | 88 | } __packed; |
87 | 89 | ||
88 | struct dm_cache_metadata { | 90 | struct dm_cache_metadata { |
@@ -109,6 +111,7 @@ struct dm_cache_metadata { | |||
109 | bool clean_when_opened:1; | 111 | bool clean_when_opened:1; |
110 | 112 | ||
111 | char policy_name[CACHE_POLICY_NAME_SIZE]; | 113 | char policy_name[CACHE_POLICY_NAME_SIZE]; |
114 | unsigned policy_version[CACHE_POLICY_VERSION_SIZE]; | ||
112 | size_t policy_hint_size; | 115 | size_t policy_hint_size; |
113 | struct dm_cache_statistics stats; | 116 | struct dm_cache_statistics stats; |
114 | }; | 117 | }; |
@@ -268,7 +271,8 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
268 | memset(disk_super->uuid, 0, sizeof(disk_super->uuid)); | 271 | memset(disk_super->uuid, 0, sizeof(disk_super->uuid)); |
269 | disk_super->magic = cpu_to_le64(CACHE_SUPERBLOCK_MAGIC); | 272 | disk_super->magic = cpu_to_le64(CACHE_SUPERBLOCK_MAGIC); |
270 | disk_super->version = cpu_to_le32(CACHE_VERSION); | 273 | disk_super->version = cpu_to_le32(CACHE_VERSION); |
271 | memset(disk_super->policy_name, 0, CACHE_POLICY_NAME_SIZE); | 274 | memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); |
275 | memset(disk_super->policy_version, 0, sizeof(disk_super->policy_version)); | ||
272 | disk_super->policy_hint_size = 0; | 276 | disk_super->policy_hint_size = 0; |
273 | 277 | ||
274 | r = dm_sm_copy_root(cmd->metadata_sm, &disk_super->metadata_space_map_root, | 278 | r = dm_sm_copy_root(cmd->metadata_sm, &disk_super->metadata_space_map_root, |
@@ -284,7 +288,6 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
284 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 288 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); |
285 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); | 289 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); |
286 | disk_super->cache_blocks = cpu_to_le32(0); | 290 | disk_super->cache_blocks = cpu_to_le32(0); |
287 | memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); | ||
288 | 291 | ||
289 | disk_super->read_hits = cpu_to_le32(0); | 292 | disk_super->read_hits = cpu_to_le32(0); |
290 | disk_super->read_misses = cpu_to_le32(0); | 293 | disk_super->read_misses = cpu_to_le32(0); |
@@ -478,6 +481,9 @@ static void read_superblock_fields(struct dm_cache_metadata *cmd, | |||
478 | cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); | 481 | cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); |
479 | cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); | 482 | cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); |
480 | strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); | 483 | strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); |
484 | cmd->policy_version[0] = le32_to_cpu(disk_super->policy_version[0]); | ||
485 | cmd->policy_version[1] = le32_to_cpu(disk_super->policy_version[1]); | ||
486 | cmd->policy_version[2] = le32_to_cpu(disk_super->policy_version[2]); | ||
481 | cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); | 487 | cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); |
482 | 488 | ||
483 | cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); | 489 | cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); |
@@ -572,6 +578,9 @@ static int __commit_transaction(struct dm_cache_metadata *cmd, | |||
572 | disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); | 578 | disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); |
573 | disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); | 579 | disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); |
574 | strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); | 580 | strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); |
581 | disk_super->policy_version[0] = cpu_to_le32(cmd->policy_version[0]); | ||
582 | disk_super->policy_version[1] = cpu_to_le32(cmd->policy_version[1]); | ||
583 | disk_super->policy_version[2] = cpu_to_le32(cmd->policy_version[2]); | ||
575 | 584 | ||
576 | disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); | 585 | disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); |
577 | disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); | 586 | disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); |
@@ -854,18 +863,43 @@ struct thunk { | |||
854 | bool hints_valid; | 863 | bool hints_valid; |
855 | }; | 864 | }; |
856 | 865 | ||
866 | static bool policy_unchanged(struct dm_cache_metadata *cmd, | ||
867 | struct dm_cache_policy *policy) | ||
868 | { | ||
869 | const char *policy_name = dm_cache_policy_get_name(policy); | ||
870 | const unsigned *policy_version = dm_cache_policy_get_version(policy); | ||
871 | size_t policy_hint_size = dm_cache_policy_get_hint_size(policy); | ||
872 | |||
873 | /* | ||
874 | * Ensure policy names match. | ||
875 | */ | ||
876 | if (strncmp(cmd->policy_name, policy_name, sizeof(cmd->policy_name))) | ||
877 | return false; | ||
878 | |||
879 | /* | ||
880 | * Ensure policy major versions match. | ||
881 | */ | ||
882 | if (cmd->policy_version[0] != policy_version[0]) | ||
883 | return false; | ||
884 | |||
885 | /* | ||
886 | * Ensure policy hint sizes match. | ||
887 | */ | ||
888 | if (cmd->policy_hint_size != policy_hint_size) | ||
889 | return false; | ||
890 | |||
891 | return true; | ||
892 | } | ||
893 | |||
857 | static bool hints_array_initialized(struct dm_cache_metadata *cmd) | 894 | static bool hints_array_initialized(struct dm_cache_metadata *cmd) |
858 | { | 895 | { |
859 | return cmd->hint_root && cmd->policy_hint_size; | 896 | return cmd->hint_root && cmd->policy_hint_size; |
860 | } | 897 | } |
861 | 898 | ||
862 | static bool hints_array_available(struct dm_cache_metadata *cmd, | 899 | static bool hints_array_available(struct dm_cache_metadata *cmd, |
863 | const char *policy_name) | 900 | struct dm_cache_policy *policy) |
864 | { | 901 | { |
865 | bool policy_names_match = !strncmp(cmd->policy_name, policy_name, | 902 | return cmd->clean_when_opened && policy_unchanged(cmd, policy) && |
866 | sizeof(cmd->policy_name)); | ||
867 | |||
868 | return cmd->clean_when_opened && policy_names_match && | ||
869 | hints_array_initialized(cmd); | 903 | hints_array_initialized(cmd); |
870 | } | 904 | } |
871 | 905 | ||
@@ -899,7 +933,8 @@ static int __load_mapping(void *context, uint64_t cblock, void *leaf) | |||
899 | return r; | 933 | return r; |
900 | } | 934 | } |
901 | 935 | ||
902 | static int __load_mappings(struct dm_cache_metadata *cmd, const char *policy_name, | 936 | static int __load_mappings(struct dm_cache_metadata *cmd, |
937 | struct dm_cache_policy *policy, | ||
903 | load_mapping_fn fn, void *context) | 938 | load_mapping_fn fn, void *context) |
904 | { | 939 | { |
905 | struct thunk thunk; | 940 | struct thunk thunk; |
@@ -909,18 +944,19 @@ static int __load_mappings(struct dm_cache_metadata *cmd, const char *policy_nam | |||
909 | 944 | ||
910 | thunk.cmd = cmd; | 945 | thunk.cmd = cmd; |
911 | thunk.respect_dirty_flags = cmd->clean_when_opened; | 946 | thunk.respect_dirty_flags = cmd->clean_when_opened; |
912 | thunk.hints_valid = hints_array_available(cmd, policy_name); | 947 | thunk.hints_valid = hints_array_available(cmd, policy); |
913 | 948 | ||
914 | return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); | 949 | return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); |
915 | } | 950 | } |
916 | 951 | ||
917 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, const char *policy_name, | 952 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, |
953 | struct dm_cache_policy *policy, | ||
918 | load_mapping_fn fn, void *context) | 954 | load_mapping_fn fn, void *context) |
919 | { | 955 | { |
920 | int r; | 956 | int r; |
921 | 957 | ||
922 | down_read(&cmd->root_lock); | 958 | down_read(&cmd->root_lock); |
923 | r = __load_mappings(cmd, policy_name, fn, context); | 959 | r = __load_mappings(cmd, policy, fn, context); |
924 | up_read(&cmd->root_lock); | 960 | up_read(&cmd->root_lock); |
925 | 961 | ||
926 | return r; | 962 | return r; |
@@ -979,7 +1015,7 @@ static int __dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty | |||
979 | /* nothing to be done */ | 1015 | /* nothing to be done */ |
980 | return 0; | 1016 | return 0; |
981 | 1017 | ||
982 | value = pack_value(oblock, flags | (dirty ? M_DIRTY : 0)); | 1018 | value = pack_value(oblock, (flags & ~M_DIRTY) | (dirty ? M_DIRTY : 0)); |
983 | __dm_bless_for_disk(&value); | 1019 | __dm_bless_for_disk(&value); |
984 | 1020 | ||
985 | r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), | 1021 | r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), |
@@ -1070,13 +1106,15 @@ static int begin_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *po | |||
1070 | __le32 value; | 1106 | __le32 value; |
1071 | size_t hint_size; | 1107 | size_t hint_size; |
1072 | const char *policy_name = dm_cache_policy_get_name(policy); | 1108 | const char *policy_name = dm_cache_policy_get_name(policy); |
1109 | const unsigned *policy_version = dm_cache_policy_get_version(policy); | ||
1073 | 1110 | ||
1074 | if (!policy_name[0] || | 1111 | if (!policy_name[0] || |
1075 | (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) | 1112 | (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) |
1076 | return -EINVAL; | 1113 | return -EINVAL; |
1077 | 1114 | ||
1078 | if (strcmp(cmd->policy_name, policy_name)) { | 1115 | if (!policy_unchanged(cmd, policy)) { |
1079 | strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); | 1116 | strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); |
1117 | memcpy(cmd->policy_version, policy_version, sizeof(cmd->policy_version)); | ||
1080 | 1118 | ||
1081 | hint_size = dm_cache_policy_get_hint_size(policy); | 1119 | hint_size = dm_cache_policy_get_hint_size(policy); |
1082 | if (!hint_size) | 1120 | if (!hint_size) |
diff --git a/drivers/md/dm-cache-metadata.h b/drivers/md/dm-cache-metadata.h index 135864ea0eee..f45cef21f3d0 100644 --- a/drivers/md/dm-cache-metadata.h +++ b/drivers/md/dm-cache-metadata.h | |||
@@ -89,7 +89,7 @@ typedef int (*load_mapping_fn)(void *context, dm_oblock_t oblock, | |||
89 | dm_cblock_t cblock, bool dirty, | 89 | dm_cblock_t cblock, bool dirty, |
90 | uint32_t hint, bool hint_valid); | 90 | uint32_t hint, bool hint_valid); |
91 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, | 91 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, |
92 | const char *policy_name, | 92 | struct dm_cache_policy *policy, |
93 | load_mapping_fn fn, | 93 | load_mapping_fn fn, |
94 | void *context); | 94 | void *context); |
95 | 95 | ||
diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c index cc05d70b3cb8..b04d1f904d07 100644 --- a/drivers/md/dm-cache-policy-cleaner.c +++ b/drivers/md/dm-cache-policy-cleaner.c | |||
@@ -17,7 +17,6 @@ | |||
17 | /*----------------------------------------------------------------*/ | 17 | /*----------------------------------------------------------------*/ |
18 | 18 | ||
19 | #define DM_MSG_PREFIX "cache cleaner" | 19 | #define DM_MSG_PREFIX "cache cleaner" |
20 | #define CLEANER_VERSION "1.0.0" | ||
21 | 20 | ||
22 | /* Cache entry struct. */ | 21 | /* Cache entry struct. */ |
23 | struct wb_cache_entry { | 22 | struct wb_cache_entry { |
@@ -434,6 +433,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size, | |||
434 | 433 | ||
435 | static struct dm_cache_policy_type wb_policy_type = { | 434 | static struct dm_cache_policy_type wb_policy_type = { |
436 | .name = "cleaner", | 435 | .name = "cleaner", |
436 | .version = {1, 0, 0}, | ||
437 | .hint_size = 0, | 437 | .hint_size = 0, |
438 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
439 | .create = wb_create | 439 | .create = wb_create |
@@ -446,7 +446,10 @@ static int __init wb_init(void) | |||
446 | if (r < 0) | 446 | if (r < 0) |
447 | DMERR("register failed %d", r); | 447 | DMERR("register failed %d", r); |
448 | else | 448 | else |
449 | DMINFO("version " CLEANER_VERSION " loaded"); | 449 | DMINFO("version %u.%u.%u loaded", |
450 | wb_policy_type.version[0], | ||
451 | wb_policy_type.version[1], | ||
452 | wb_policy_type.version[2]); | ||
450 | 453 | ||
451 | return r; | 454 | return r; |
452 | } | 455 | } |
diff --git a/drivers/md/dm-cache-policy-internal.h b/drivers/md/dm-cache-policy-internal.h index 52a75beeced5..0928abdc49f0 100644 --- a/drivers/md/dm-cache-policy-internal.h +++ b/drivers/md/dm-cache-policy-internal.h | |||
@@ -117,6 +117,8 @@ void dm_cache_policy_destroy(struct dm_cache_policy *p); | |||
117 | */ | 117 | */ |
118 | const char *dm_cache_policy_get_name(struct dm_cache_policy *p); | 118 | const char *dm_cache_policy_get_name(struct dm_cache_policy *p); |
119 | 119 | ||
120 | const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p); | ||
121 | |||
120 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p); | 122 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p); |
121 | 123 | ||
122 | /*----------------------------------------------------------------*/ | 124 | /*----------------------------------------------------------------*/ |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 964153255076..dc112a7137fe 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | 15 | ||
16 | #define DM_MSG_PREFIX "cache-policy-mq" | 16 | #define DM_MSG_PREFIX "cache-policy-mq" |
17 | #define MQ_VERSION "1.0.0" | ||
18 | 17 | ||
19 | static struct kmem_cache *mq_entry_cache; | 18 | static struct kmem_cache *mq_entry_cache; |
20 | 19 | ||
@@ -1133,6 +1132,7 @@ bad_cache_alloc: | |||
1133 | 1132 | ||
1134 | static struct dm_cache_policy_type mq_policy_type = { | 1133 | static struct dm_cache_policy_type mq_policy_type = { |
1135 | .name = "mq", | 1134 | .name = "mq", |
1135 | .version = {1, 0, 0}, | ||
1136 | .hint_size = 4, | 1136 | .hint_size = 4, |
1137 | .owner = THIS_MODULE, | 1137 | .owner = THIS_MODULE, |
1138 | .create = mq_create | 1138 | .create = mq_create |
@@ -1140,6 +1140,7 @@ static struct dm_cache_policy_type mq_policy_type = { | |||
1140 | 1140 | ||
1141 | static struct dm_cache_policy_type default_policy_type = { | 1141 | static struct dm_cache_policy_type default_policy_type = { |
1142 | .name = "default", | 1142 | .name = "default", |
1143 | .version = {1, 0, 0}, | ||
1143 | .hint_size = 4, | 1144 | .hint_size = 4, |
1144 | .owner = THIS_MODULE, | 1145 | .owner = THIS_MODULE, |
1145 | .create = mq_create | 1146 | .create = mq_create |
@@ -1164,7 +1165,10 @@ static int __init mq_init(void) | |||
1164 | 1165 | ||
1165 | r = dm_cache_policy_register(&default_policy_type); | 1166 | r = dm_cache_policy_register(&default_policy_type); |
1166 | if (!r) { | 1167 | if (!r) { |
1167 | DMINFO("version " MQ_VERSION " loaded"); | 1168 | DMINFO("version %u.%u.%u loaded", |
1169 | mq_policy_type.version[0], | ||
1170 | mq_policy_type.version[1], | ||
1171 | mq_policy_type.version[2]); | ||
1168 | return 0; | 1172 | return 0; |
1169 | } | 1173 | } |
1170 | 1174 | ||
diff --git a/drivers/md/dm-cache-policy.c b/drivers/md/dm-cache-policy.c index 2cbf5fdaac52..21c03c570c06 100644 --- a/drivers/md/dm-cache-policy.c +++ b/drivers/md/dm-cache-policy.c | |||
@@ -150,6 +150,14 @@ const char *dm_cache_policy_get_name(struct dm_cache_policy *p) | |||
150 | } | 150 | } |
151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); | 151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); |
152 | 152 | ||
153 | const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p) | ||
154 | { | ||
155 | struct dm_cache_policy_type *t = p->private; | ||
156 | |||
157 | return t->version; | ||
158 | } | ||
159 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_version); | ||
160 | |||
153 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p) | 161 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p) |
154 | { | 162 | { |
155 | struct dm_cache_policy_type *t = p->private; | 163 | struct dm_cache_policy_type *t = p->private; |
diff --git a/drivers/md/dm-cache-policy.h b/drivers/md/dm-cache-policy.h index f0f51b260544..558bdfdabf5f 100644 --- a/drivers/md/dm-cache-policy.h +++ b/drivers/md/dm-cache-policy.h | |||
@@ -196,6 +196,7 @@ struct dm_cache_policy { | |||
196 | * We maintain a little register of the different policy types. | 196 | * We maintain a little register of the different policy types. |
197 | */ | 197 | */ |
198 | #define CACHE_POLICY_NAME_SIZE 16 | 198 | #define CACHE_POLICY_NAME_SIZE 16 |
199 | #define CACHE_POLICY_VERSION_SIZE 3 | ||
199 | 200 | ||
200 | struct dm_cache_policy_type { | 201 | struct dm_cache_policy_type { |
201 | /* For use by the register code only. */ | 202 | /* For use by the register code only. */ |
@@ -206,6 +207,7 @@ struct dm_cache_policy_type { | |||
206 | * what gets passed on the target line to select your policy. | 207 | * what gets passed on the target line to select your policy. |
207 | */ | 208 | */ |
208 | char name[CACHE_POLICY_NAME_SIZE]; | 209 | char name[CACHE_POLICY_NAME_SIZE]; |
210 | unsigned version[CACHE_POLICY_VERSION_SIZE]; | ||
209 | 211 | ||
210 | /* | 212 | /* |
211 | * Policies may store a hint for each each cache block. | 213 | * Policies may store a hint for each each cache block. |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 0f4e84b15c30..10744091e6ca 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include "dm.h" | 7 | #include "dm.h" |
8 | #include "dm-bio-prison.h" | 8 | #include "dm-bio-prison.h" |
9 | #include "dm-bio-record.h" | ||
9 | #include "dm-cache-metadata.h" | 10 | #include "dm-cache-metadata.h" |
10 | 11 | ||
11 | #include <linux/dm-io.h> | 12 | #include <linux/dm-io.h> |
@@ -142,6 +143,7 @@ struct cache { | |||
142 | spinlock_t lock; | 143 | spinlock_t lock; |
143 | struct bio_list deferred_bios; | 144 | struct bio_list deferred_bios; |
144 | struct bio_list deferred_flush_bios; | 145 | struct bio_list deferred_flush_bios; |
146 | struct bio_list deferred_writethrough_bios; | ||
145 | struct list_head quiesced_migrations; | 147 | struct list_head quiesced_migrations; |
146 | struct list_head completed_migrations; | 148 | struct list_head completed_migrations; |
147 | struct list_head need_commit_migrations; | 149 | struct list_head need_commit_migrations; |
@@ -158,7 +160,7 @@ struct cache { | |||
158 | /* | 160 | /* |
159 | * origin_blocks entries, discarded if set. | 161 | * origin_blocks entries, discarded if set. |
160 | */ | 162 | */ |
161 | sector_t discard_block_size; /* a power of 2 times sectors per block */ | 163 | uint32_t discard_block_size; /* a power of 2 times sectors per block */ |
162 | dm_dblock_t discard_nr_blocks; | 164 | dm_dblock_t discard_nr_blocks; |
163 | unsigned long *discard_bitset; | 165 | unsigned long *discard_bitset; |
164 | 166 | ||
@@ -199,6 +201,16 @@ struct per_bio_data { | |||
199 | bool tick:1; | 201 | bool tick:1; |
200 | unsigned req_nr:2; | 202 | unsigned req_nr:2; |
201 | struct dm_deferred_entry *all_io_entry; | 203 | struct dm_deferred_entry *all_io_entry; |
204 | |||
205 | /* | ||
206 | * writethrough fields. These MUST remain at the end of this | ||
207 | * structure and the 'cache' member must be the first as it | ||
208 | * is used to determine the offsetof the writethrough fields. | ||
209 | */ | ||
210 | struct cache *cache; | ||
211 | dm_cblock_t cblock; | ||
212 | bio_end_io_t *saved_bi_end_io; | ||
213 | struct dm_bio_details bio_details; | ||
202 | }; | 214 | }; |
203 | 215 | ||
204 | struct dm_cache_migration { | 216 | struct dm_cache_migration { |
@@ -412,17 +424,24 @@ static bool block_size_is_power_of_two(struct cache *cache) | |||
412 | return cache->sectors_per_block_shift >= 0; | 424 | return cache->sectors_per_block_shift >= 0; |
413 | } | 425 | } |
414 | 426 | ||
427 | static dm_block_t block_div(dm_block_t b, uint32_t n) | ||
428 | { | ||
429 | do_div(b, n); | ||
430 | |||
431 | return b; | ||
432 | } | ||
433 | |||
415 | static dm_dblock_t oblock_to_dblock(struct cache *cache, dm_oblock_t oblock) | 434 | static dm_dblock_t oblock_to_dblock(struct cache *cache, dm_oblock_t oblock) |
416 | { | 435 | { |
417 | sector_t discard_blocks = cache->discard_block_size; | 436 | uint32_t discard_blocks = cache->discard_block_size; |
418 | dm_block_t b = from_oblock(oblock); | 437 | dm_block_t b = from_oblock(oblock); |
419 | 438 | ||
420 | if (!block_size_is_power_of_two(cache)) | 439 | if (!block_size_is_power_of_two(cache)) |
421 | (void) sector_div(discard_blocks, cache->sectors_per_block); | 440 | discard_blocks = discard_blocks / cache->sectors_per_block; |
422 | else | 441 | else |
423 | discard_blocks >>= cache->sectors_per_block_shift; | 442 | discard_blocks >>= cache->sectors_per_block_shift; |
424 | 443 | ||
425 | (void) sector_div(b, discard_blocks); | 444 | b = block_div(b, discard_blocks); |
426 | 445 | ||
427 | return to_dblock(b); | 446 | return to_dblock(b); |
428 | } | 447 | } |
@@ -500,16 +519,28 @@ static void save_stats(struct cache *cache) | |||
500 | /*---------------------------------------------------------------- | 519 | /*---------------------------------------------------------------- |
501 | * Per bio data | 520 | * Per bio data |
502 | *--------------------------------------------------------------*/ | 521 | *--------------------------------------------------------------*/ |
503 | static struct per_bio_data *get_per_bio_data(struct bio *bio) | 522 | |
523 | /* | ||
524 | * If using writeback, leave out struct per_bio_data's writethrough fields. | ||
525 | */ | ||
526 | #define PB_DATA_SIZE_WB (offsetof(struct per_bio_data, cache)) | ||
527 | #define PB_DATA_SIZE_WT (sizeof(struct per_bio_data)) | ||
528 | |||
529 | static size_t get_per_bio_data_size(struct cache *cache) | ||
504 | { | 530 | { |
505 | struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); | 531 | return cache->features.write_through ? PB_DATA_SIZE_WT : PB_DATA_SIZE_WB; |
532 | } | ||
533 | |||
534 | static struct per_bio_data *get_per_bio_data(struct bio *bio, size_t data_size) | ||
535 | { | ||
536 | struct per_bio_data *pb = dm_per_bio_data(bio, data_size); | ||
506 | BUG_ON(!pb); | 537 | BUG_ON(!pb); |
507 | return pb; | 538 | return pb; |
508 | } | 539 | } |
509 | 540 | ||
510 | static struct per_bio_data *init_per_bio_data(struct bio *bio) | 541 | static struct per_bio_data *init_per_bio_data(struct bio *bio, size_t data_size) |
511 | { | 542 | { |
512 | struct per_bio_data *pb = get_per_bio_data(bio); | 543 | struct per_bio_data *pb = get_per_bio_data(bio, data_size); |
513 | 544 | ||
514 | pb->tick = false; | 545 | pb->tick = false; |
515 | pb->req_nr = dm_bio_get_target_bio_nr(bio); | 546 | pb->req_nr = dm_bio_get_target_bio_nr(bio); |
@@ -543,7 +574,8 @@ static void remap_to_cache(struct cache *cache, struct bio *bio, | |||
543 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) | 574 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) |
544 | { | 575 | { |
545 | unsigned long flags; | 576 | unsigned long flags; |
546 | struct per_bio_data *pb = get_per_bio_data(bio); | 577 | size_t pb_data_size = get_per_bio_data_size(cache); |
578 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
547 | 579 | ||
548 | spin_lock_irqsave(&cache->lock, flags); | 580 | spin_lock_irqsave(&cache->lock, flags); |
549 | if (cache->need_tick_bio && | 581 | if (cache->need_tick_bio && |
@@ -609,6 +641,58 @@ static void issue(struct cache *cache, struct bio *bio) | |||
609 | spin_unlock_irqrestore(&cache->lock, flags); | 641 | spin_unlock_irqrestore(&cache->lock, flags); |
610 | } | 642 | } |
611 | 643 | ||
644 | static void defer_writethrough_bio(struct cache *cache, struct bio *bio) | ||
645 | { | ||
646 | unsigned long flags; | ||
647 | |||
648 | spin_lock_irqsave(&cache->lock, flags); | ||
649 | bio_list_add(&cache->deferred_writethrough_bios, bio); | ||
650 | spin_unlock_irqrestore(&cache->lock, flags); | ||
651 | |||
652 | wake_worker(cache); | ||
653 | } | ||
654 | |||
655 | static void writethrough_endio(struct bio *bio, int err) | ||
656 | { | ||
657 | struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT); | ||
658 | bio->bi_end_io = pb->saved_bi_end_io; | ||
659 | |||
660 | if (err) { | ||
661 | bio_endio(bio, err); | ||
662 | return; | ||
663 | } | ||
664 | |||
665 | dm_bio_restore(&pb->bio_details, bio); | ||
666 | remap_to_cache(pb->cache, bio, pb->cblock); | ||
667 | |||
668 | /* | ||
669 | * We can't issue this bio directly, since we're in interrupt | ||
670 | * context. So it get's put on a bio list for processing by the | ||
671 | * worker thread. | ||
672 | */ | ||
673 | defer_writethrough_bio(pb->cache, bio); | ||
674 | } | ||
675 | |||
676 | /* | ||
677 | * When running in writethrough mode we need to send writes to clean blocks | ||
678 | * to both the cache and origin devices. In future we'd like to clone the | ||
679 | * bio and send them in parallel, but for now we're doing them in | ||
680 | * series as this is easier. | ||
681 | */ | ||
682 | static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, | ||
683 | dm_oblock_t oblock, dm_cblock_t cblock) | ||
684 | { | ||
685 | struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT); | ||
686 | |||
687 | pb->cache = cache; | ||
688 | pb->cblock = cblock; | ||
689 | pb->saved_bi_end_io = bio->bi_end_io; | ||
690 | dm_bio_record(&pb->bio_details, bio); | ||
691 | bio->bi_end_io = writethrough_endio; | ||
692 | |||
693 | remap_to_origin_clear_discard(pb->cache, bio, oblock); | ||
694 | } | ||
695 | |||
612 | /*---------------------------------------------------------------- | 696 | /*---------------------------------------------------------------- |
613 | * Migration processing | 697 | * Migration processing |
614 | * | 698 | * |
@@ -972,7 +1056,8 @@ static void defer_bio(struct cache *cache, struct bio *bio) | |||
972 | 1056 | ||
973 | static void process_flush_bio(struct cache *cache, struct bio *bio) | 1057 | static void process_flush_bio(struct cache *cache, struct bio *bio) |
974 | { | 1058 | { |
975 | struct per_bio_data *pb = get_per_bio_data(bio); | 1059 | size_t pb_data_size = get_per_bio_data_size(cache); |
1060 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
976 | 1061 | ||
977 | BUG_ON(bio->bi_size); | 1062 | BUG_ON(bio->bi_size); |
978 | if (!pb->req_nr) | 1063 | if (!pb->req_nr) |
@@ -1002,7 +1087,7 @@ static void process_discard_bio(struct cache *cache, struct bio *bio) | |||
1002 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); | 1087 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); |
1003 | dm_block_t b; | 1088 | dm_block_t b; |
1004 | 1089 | ||
1005 | (void) sector_div(end_block, cache->discard_block_size); | 1090 | end_block = block_div(end_block, cache->discard_block_size); |
1006 | 1091 | ||
1007 | for (b = start_block; b < end_block; b++) | 1092 | for (b = start_block; b < end_block; b++) |
1008 | set_discard(cache, to_dblock(b)); | 1093 | set_discard(cache, to_dblock(b)); |
@@ -1044,7 +1129,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1044 | dm_oblock_t block = get_bio_block(cache, bio); | 1129 | dm_oblock_t block = get_bio_block(cache, bio); |
1045 | struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; | 1130 | struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; |
1046 | struct policy_result lookup_result; | 1131 | struct policy_result lookup_result; |
1047 | struct per_bio_data *pb = get_per_bio_data(bio); | 1132 | size_t pb_data_size = get_per_bio_data_size(cache); |
1133 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
1048 | bool discarded_block = is_discarded_oblock(cache, block); | 1134 | bool discarded_block = is_discarded_oblock(cache, block); |
1049 | bool can_migrate = discarded_block || spare_migration_bandwidth(cache); | 1135 | bool can_migrate = discarded_block || spare_migration_bandwidth(cache); |
1050 | 1136 | ||
@@ -1070,14 +1156,9 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1070 | inc_hit_counter(cache, bio); | 1156 | inc_hit_counter(cache, bio); |
1071 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 1157 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
1072 | 1158 | ||
1073 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) { | 1159 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) |
1074 | /* | 1160 | remap_to_origin_then_cache(cache, bio, block, lookup_result.cblock); |
1075 | * No need to mark anything dirty in write through mode. | 1161 | else |
1076 | */ | ||
1077 | pb->req_nr == 0 ? | ||
1078 | remap_to_cache(cache, bio, lookup_result.cblock) : | ||
1079 | remap_to_origin_clear_discard(cache, bio, block); | ||
1080 | } else | ||
1081 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); | 1162 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); |
1082 | 1163 | ||
1083 | issue(cache, bio); | 1164 | issue(cache, bio); |
@@ -1086,17 +1167,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1086 | case POLICY_MISS: | 1167 | case POLICY_MISS: |
1087 | inc_miss_counter(cache, bio); | 1168 | inc_miss_counter(cache, bio); |
1088 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 1169 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
1089 | 1170 | remap_to_origin_clear_discard(cache, bio, block); | |
1090 | if (pb->req_nr != 0) { | 1171 | issue(cache, bio); |
1091 | /* | ||
1092 | * This is a duplicate writethrough io that is no | ||
1093 | * longer needed because the block has been demoted. | ||
1094 | */ | ||
1095 | bio_endio(bio, 0); | ||
1096 | } else { | ||
1097 | remap_to_origin_clear_discard(cache, bio, block); | ||
1098 | issue(cache, bio); | ||
1099 | } | ||
1100 | break; | 1172 | break; |
1101 | 1173 | ||
1102 | case POLICY_NEW: | 1174 | case POLICY_NEW: |
@@ -1217,6 +1289,23 @@ static void process_deferred_flush_bios(struct cache *cache, bool submit_bios) | |||
1217 | submit_bios ? generic_make_request(bio) : bio_io_error(bio); | 1289 | submit_bios ? generic_make_request(bio) : bio_io_error(bio); |
1218 | } | 1290 | } |
1219 | 1291 | ||
1292 | static void process_deferred_writethrough_bios(struct cache *cache) | ||
1293 | { | ||
1294 | unsigned long flags; | ||
1295 | struct bio_list bios; | ||
1296 | struct bio *bio; | ||
1297 | |||
1298 | bio_list_init(&bios); | ||
1299 | |||
1300 | spin_lock_irqsave(&cache->lock, flags); | ||
1301 | bio_list_merge(&bios, &cache->deferred_writethrough_bios); | ||
1302 | bio_list_init(&cache->deferred_writethrough_bios); | ||
1303 | spin_unlock_irqrestore(&cache->lock, flags); | ||
1304 | |||
1305 | while ((bio = bio_list_pop(&bios))) | ||
1306 | generic_make_request(bio); | ||
1307 | } | ||
1308 | |||
1220 | static void writeback_some_dirty_blocks(struct cache *cache) | 1309 | static void writeback_some_dirty_blocks(struct cache *cache) |
1221 | { | 1310 | { |
1222 | int r = 0; | 1311 | int r = 0; |
@@ -1313,6 +1402,7 @@ static int more_work(struct cache *cache) | |||
1313 | else | 1402 | else |
1314 | return !bio_list_empty(&cache->deferred_bios) || | 1403 | return !bio_list_empty(&cache->deferred_bios) || |
1315 | !bio_list_empty(&cache->deferred_flush_bios) || | 1404 | !bio_list_empty(&cache->deferred_flush_bios) || |
1405 | !bio_list_empty(&cache->deferred_writethrough_bios) || | ||
1316 | !list_empty(&cache->quiesced_migrations) || | 1406 | !list_empty(&cache->quiesced_migrations) || |
1317 | !list_empty(&cache->completed_migrations) || | 1407 | !list_empty(&cache->completed_migrations) || |
1318 | !list_empty(&cache->need_commit_migrations); | 1408 | !list_empty(&cache->need_commit_migrations); |
@@ -1331,6 +1421,8 @@ static void do_worker(struct work_struct *ws) | |||
1331 | 1421 | ||
1332 | writeback_some_dirty_blocks(cache); | 1422 | writeback_some_dirty_blocks(cache); |
1333 | 1423 | ||
1424 | process_deferred_writethrough_bios(cache); | ||
1425 | |||
1334 | if (commit_if_needed(cache)) { | 1426 | if (commit_if_needed(cache)) { |
1335 | process_deferred_flush_bios(cache, false); | 1427 | process_deferred_flush_bios(cache, false); |
1336 | 1428 | ||
@@ -1756,8 +1848,11 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca, | |||
1756 | } | 1848 | } |
1757 | 1849 | ||
1758 | r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); | 1850 | r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); |
1759 | if (r) | 1851 | if (r) { |
1852 | *error = "Error setting cache policy's config values"; | ||
1760 | dm_cache_policy_destroy(cache->policy); | 1853 | dm_cache_policy_destroy(cache->policy); |
1854 | cache->policy = NULL; | ||
1855 | } | ||
1761 | 1856 | ||
1762 | return r; | 1857 | return r; |
1763 | } | 1858 | } |
@@ -1793,8 +1888,6 @@ static sector_t calculate_discard_block_size(sector_t cache_block_size, | |||
1793 | 1888 | ||
1794 | #define DEFAULT_MIGRATION_THRESHOLD (2048 * 100) | 1889 | #define DEFAULT_MIGRATION_THRESHOLD (2048 * 100) |
1795 | 1890 | ||
1796 | static unsigned cache_num_write_bios(struct dm_target *ti, struct bio *bio); | ||
1797 | |||
1798 | static int cache_create(struct cache_args *ca, struct cache **result) | 1891 | static int cache_create(struct cache_args *ca, struct cache **result) |
1799 | { | 1892 | { |
1800 | int r = 0; | 1893 | int r = 0; |
@@ -1811,7 +1904,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1811 | 1904 | ||
1812 | cache->ti = ca->ti; | 1905 | cache->ti = ca->ti; |
1813 | ti->private = cache; | 1906 | ti->private = cache; |
1814 | ti->per_bio_data_size = sizeof(struct per_bio_data); | ||
1815 | ti->num_flush_bios = 2; | 1907 | ti->num_flush_bios = 2; |
1816 | ti->flush_supported = true; | 1908 | ti->flush_supported = true; |
1817 | 1909 | ||
@@ -1820,9 +1912,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1820 | ti->discard_zeroes_data_unsupported = true; | 1912 | ti->discard_zeroes_data_unsupported = true; |
1821 | 1913 | ||
1822 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); | 1914 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); |
1823 | 1915 | ti->per_bio_data_size = get_per_bio_data_size(cache); | |
1824 | if (cache->features.write_through) | ||
1825 | ti->num_write_bios = cache_num_write_bios; | ||
1826 | 1916 | ||
1827 | cache->callbacks.congested_fn = cache_is_congested; | 1917 | cache->callbacks.congested_fn = cache_is_congested; |
1828 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); | 1918 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); |
@@ -1835,7 +1925,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1835 | 1925 | ||
1836 | /* FIXME: factor out this whole section */ | 1926 | /* FIXME: factor out this whole section */ |
1837 | origin_blocks = cache->origin_sectors = ca->origin_sectors; | 1927 | origin_blocks = cache->origin_sectors = ca->origin_sectors; |
1838 | (void) sector_div(origin_blocks, ca->block_size); | 1928 | origin_blocks = block_div(origin_blocks, ca->block_size); |
1839 | cache->origin_blocks = to_oblock(origin_blocks); | 1929 | cache->origin_blocks = to_oblock(origin_blocks); |
1840 | 1930 | ||
1841 | cache->sectors_per_block = ca->block_size; | 1931 | cache->sectors_per_block = ca->block_size; |
@@ -1848,7 +1938,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1848 | dm_block_t cache_size = ca->cache_sectors; | 1938 | dm_block_t cache_size = ca->cache_sectors; |
1849 | 1939 | ||
1850 | cache->sectors_per_block_shift = -1; | 1940 | cache->sectors_per_block_shift = -1; |
1851 | (void) sector_div(cache_size, ca->block_size); | 1941 | cache_size = block_div(cache_size, ca->block_size); |
1852 | cache->cache_size = to_cblock(cache_size); | 1942 | cache->cache_size = to_cblock(cache_size); |
1853 | } else { | 1943 | } else { |
1854 | cache->sectors_per_block_shift = __ffs(ca->block_size); | 1944 | cache->sectors_per_block_shift = __ffs(ca->block_size); |
@@ -1873,6 +1963,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1873 | spin_lock_init(&cache->lock); | 1963 | spin_lock_init(&cache->lock); |
1874 | bio_list_init(&cache->deferred_bios); | 1964 | bio_list_init(&cache->deferred_bios); |
1875 | bio_list_init(&cache->deferred_flush_bios); | 1965 | bio_list_init(&cache->deferred_flush_bios); |
1966 | bio_list_init(&cache->deferred_writethrough_bios); | ||
1876 | INIT_LIST_HEAD(&cache->quiesced_migrations); | 1967 | INIT_LIST_HEAD(&cache->quiesced_migrations); |
1877 | INIT_LIST_HEAD(&cache->completed_migrations); | 1968 | INIT_LIST_HEAD(&cache->completed_migrations); |
1878 | INIT_LIST_HEAD(&cache->need_commit_migrations); | 1969 | INIT_LIST_HEAD(&cache->need_commit_migrations); |
@@ -2002,6 +2093,8 @@ static int cache_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2002 | goto out; | 2093 | goto out; |
2003 | 2094 | ||
2004 | r = cache_create(ca, &cache); | 2095 | r = cache_create(ca, &cache); |
2096 | if (r) | ||
2097 | goto out; | ||
2005 | 2098 | ||
2006 | r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); | 2099 | r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); |
2007 | if (r) { | 2100 | if (r) { |
@@ -2016,26 +2109,13 @@ out: | |||
2016 | return r; | 2109 | return r; |
2017 | } | 2110 | } |
2018 | 2111 | ||
2019 | static unsigned cache_num_write_bios(struct dm_target *ti, struct bio *bio) | ||
2020 | { | ||
2021 | int r; | ||
2022 | struct cache *cache = ti->private; | ||
2023 | dm_oblock_t block = get_bio_block(cache, bio); | ||
2024 | dm_cblock_t cblock; | ||
2025 | |||
2026 | r = policy_lookup(cache->policy, block, &cblock); | ||
2027 | if (r < 0) | ||
2028 | return 2; /* assume the worst */ | ||
2029 | |||
2030 | return (!r && !is_dirty(cache, cblock)) ? 2 : 1; | ||
2031 | } | ||
2032 | |||
2033 | static int cache_map(struct dm_target *ti, struct bio *bio) | 2112 | static int cache_map(struct dm_target *ti, struct bio *bio) |
2034 | { | 2113 | { |
2035 | struct cache *cache = ti->private; | 2114 | struct cache *cache = ti->private; |
2036 | 2115 | ||
2037 | int r; | 2116 | int r; |
2038 | dm_oblock_t block = get_bio_block(cache, bio); | 2117 | dm_oblock_t block = get_bio_block(cache, bio); |
2118 | size_t pb_data_size = get_per_bio_data_size(cache); | ||
2039 | bool can_migrate = false; | 2119 | bool can_migrate = false; |
2040 | bool discarded_block; | 2120 | bool discarded_block; |
2041 | struct dm_bio_prison_cell *cell; | 2121 | struct dm_bio_prison_cell *cell; |
@@ -2052,7 +2132,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2052 | return DM_MAPIO_REMAPPED; | 2132 | return DM_MAPIO_REMAPPED; |
2053 | } | 2133 | } |
2054 | 2134 | ||
2055 | pb = init_per_bio_data(bio); | 2135 | pb = init_per_bio_data(bio, pb_data_size); |
2056 | 2136 | ||
2057 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { | 2137 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { |
2058 | defer_bio(cache, bio); | 2138 | defer_bio(cache, bio); |
@@ -2097,18 +2177,12 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2097 | inc_hit_counter(cache, bio); | 2177 | inc_hit_counter(cache, bio); |
2098 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 2178 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
2099 | 2179 | ||
2100 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) { | 2180 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) |
2101 | /* | 2181 | remap_to_origin_then_cache(cache, bio, block, lookup_result.cblock); |
2102 | * No need to mark anything dirty in write through mode. | 2182 | else |
2103 | */ | ||
2104 | pb->req_nr == 0 ? | ||
2105 | remap_to_cache(cache, bio, lookup_result.cblock) : | ||
2106 | remap_to_origin_clear_discard(cache, bio, block); | ||
2107 | cell_defer(cache, cell, false); | ||
2108 | } else { | ||
2109 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); | 2183 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); |
2110 | cell_defer(cache, cell, false); | 2184 | |
2111 | } | 2185 | cell_defer(cache, cell, false); |
2112 | break; | 2186 | break; |
2113 | 2187 | ||
2114 | case POLICY_MISS: | 2188 | case POLICY_MISS: |
@@ -2143,7 +2217,8 @@ static int cache_end_io(struct dm_target *ti, struct bio *bio, int error) | |||
2143 | { | 2217 | { |
2144 | struct cache *cache = ti->private; | 2218 | struct cache *cache = ti->private; |
2145 | unsigned long flags; | 2219 | unsigned long flags; |
2146 | struct per_bio_data *pb = get_per_bio_data(bio); | 2220 | size_t pb_data_size = get_per_bio_data_size(cache); |
2221 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
2147 | 2222 | ||
2148 | if (pb->tick) { | 2223 | if (pb->tick) { |
2149 | policy_tick(cache->policy); | 2224 | policy_tick(cache->policy); |
@@ -2319,8 +2394,7 @@ static int cache_preresume(struct dm_target *ti) | |||
2319 | } | 2394 | } |
2320 | 2395 | ||
2321 | if (!cache->loaded_mappings) { | 2396 | if (!cache->loaded_mappings) { |
2322 | r = dm_cache_load_mappings(cache->cmd, | 2397 | r = dm_cache_load_mappings(cache->cmd, cache->policy, |
2323 | dm_cache_policy_get_name(cache->policy), | ||
2324 | load_mapping, cache); | 2398 | load_mapping, cache); |
2325 | if (r) { | 2399 | if (r) { |
2326 | DMERR("could not load cache mappings"); | 2400 | DMERR("could not load cache mappings"); |
@@ -2535,7 +2609,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
2535 | 2609 | ||
2536 | static struct target_type cache_target = { | 2610 | static struct target_type cache_target = { |
2537 | .name = "cache", | 2611 | .name = "cache", |
2538 | .version = {1, 0, 0}, | 2612 | .version = {1, 1, 0}, |
2539 | .module = THIS_MODULE, | 2613 | .module = THIS_MODULE, |
2540 | .ctr = cache_ctr, | 2614 | .ctr = cache_ctr, |
2541 | .dtr = cache_dtr, | 2615 | .dtr = cache_dtr, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 009339d62828..004ad1652b73 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1577,6 +1577,11 @@ static bool data_dev_supports_discard(struct pool_c *pt) | |||
1577 | return q && blk_queue_discard(q); | 1577 | return q && blk_queue_discard(q); |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | static bool is_factor(sector_t block_size, uint32_t n) | ||
1581 | { | ||
1582 | return !sector_div(block_size, n); | ||
1583 | } | ||
1584 | |||
1580 | /* | 1585 | /* |
1581 | * If discard_passdown was enabled verify that the data device | 1586 | * If discard_passdown was enabled verify that the data device |
1582 | * supports discards. Disable discard_passdown if not. | 1587 | * supports discards. Disable discard_passdown if not. |
@@ -1602,7 +1607,7 @@ static void disable_passdown_if_not_supported(struct pool_c *pt) | |||
1602 | else if (data_limits->discard_granularity > block_size) | 1607 | else if (data_limits->discard_granularity > block_size) |
1603 | reason = "discard granularity larger than a block"; | 1608 | reason = "discard granularity larger than a block"; |
1604 | 1609 | ||
1605 | else if (block_size & (data_limits->discard_granularity - 1)) | 1610 | else if (!is_factor(block_size, data_limits->discard_granularity)) |
1606 | reason = "discard granularity not a factor of block size"; | 1611 | reason = "discard granularity not a factor of block size"; |
1607 | 1612 | ||
1608 | if (reason) { | 1613 | if (reason) { |
@@ -2544,7 +2549,7 @@ static struct target_type pool_target = { | |||
2544 | .name = "thin-pool", | 2549 | .name = "thin-pool", |
2545 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2550 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2546 | DM_TARGET_IMMUTABLE, | 2551 | DM_TARGET_IMMUTABLE, |
2547 | .version = {1, 6, 1}, | 2552 | .version = {1, 7, 0}, |
2548 | .module = THIS_MODULE, | 2553 | .module = THIS_MODULE, |
2549 | .ctr = pool_ctr, | 2554 | .ctr = pool_ctr, |
2550 | .dtr = pool_dtr, | 2555 | .dtr = pool_dtr, |
@@ -2831,7 +2836,7 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
2831 | 2836 | ||
2832 | static struct target_type thin_target = { | 2837 | static struct target_type thin_target = { |
2833 | .name = "thin", | 2838 | .name = "thin", |
2834 | .version = {1, 7, 1}, | 2839 | .version = {1, 8, 0}, |
2835 | .module = THIS_MODULE, | 2840 | .module = THIS_MODULE, |
2836 | .ctr = thin_ctr, | 2841 | .ctr = thin_ctr, |
2837 | .dtr = thin_dtr, | 2842 | .dtr = thin_dtr, |
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 6ad538375c3c..a746f1d21c66 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
@@ -93,6 +93,13 @@ struct dm_verity_io { | |||
93 | */ | 93 | */ |
94 | }; | 94 | }; |
95 | 95 | ||
96 | struct dm_verity_prefetch_work { | ||
97 | struct work_struct work; | ||
98 | struct dm_verity *v; | ||
99 | sector_t block; | ||
100 | unsigned n_blocks; | ||
101 | }; | ||
102 | |||
96 | static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) | 103 | static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) |
97 | { | 104 | { |
98 | return (struct shash_desc *)(io + 1); | 105 | return (struct shash_desc *)(io + 1); |
@@ -424,15 +431,18 @@ static void verity_end_io(struct bio *bio, int error) | |||
424 | * The root buffer is not prefetched, it is assumed that it will be cached | 431 | * The root buffer is not prefetched, it is assumed that it will be cached |
425 | * all the time. | 432 | * all the time. |
426 | */ | 433 | */ |
427 | static void verity_prefetch_io(struct dm_verity *v, struct dm_verity_io *io) | 434 | static void verity_prefetch_io(struct work_struct *work) |
428 | { | 435 | { |
436 | struct dm_verity_prefetch_work *pw = | ||
437 | container_of(work, struct dm_verity_prefetch_work, work); | ||
438 | struct dm_verity *v = pw->v; | ||
429 | int i; | 439 | int i; |
430 | 440 | ||
431 | for (i = v->levels - 2; i >= 0; i--) { | 441 | for (i = v->levels - 2; i >= 0; i--) { |
432 | sector_t hash_block_start; | 442 | sector_t hash_block_start; |
433 | sector_t hash_block_end; | 443 | sector_t hash_block_end; |
434 | verity_hash_at_level(v, io->block, i, &hash_block_start, NULL); | 444 | verity_hash_at_level(v, pw->block, i, &hash_block_start, NULL); |
435 | verity_hash_at_level(v, io->block + io->n_blocks - 1, i, &hash_block_end, NULL); | 445 | verity_hash_at_level(v, pw->block + pw->n_blocks - 1, i, &hash_block_end, NULL); |
436 | if (!i) { | 446 | if (!i) { |
437 | unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); | 447 | unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); |
438 | 448 | ||
@@ -452,6 +462,25 @@ no_prefetch_cluster: | |||
452 | dm_bufio_prefetch(v->bufio, hash_block_start, | 462 | dm_bufio_prefetch(v->bufio, hash_block_start, |
453 | hash_block_end - hash_block_start + 1); | 463 | hash_block_end - hash_block_start + 1); |
454 | } | 464 | } |
465 | |||
466 | kfree(pw); | ||
467 | } | ||
468 | |||
469 | static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) | ||
470 | { | ||
471 | struct dm_verity_prefetch_work *pw; | ||
472 | |||
473 | pw = kmalloc(sizeof(struct dm_verity_prefetch_work), | ||
474 | GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); | ||
475 | |||
476 | if (!pw) | ||
477 | return; | ||
478 | |||
479 | INIT_WORK(&pw->work, verity_prefetch_io); | ||
480 | pw->v = v; | ||
481 | pw->block = io->block; | ||
482 | pw->n_blocks = io->n_blocks; | ||
483 | queue_work(v->verify_wq, &pw->work); | ||
455 | } | 484 | } |
456 | 485 | ||
457 | /* | 486 | /* |
@@ -498,7 +527,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio) | |||
498 | memcpy(io->io_vec, bio_iovec(bio), | 527 | memcpy(io->io_vec, bio_iovec(bio), |
499 | io->io_vec_size * sizeof(struct bio_vec)); | 528 | io->io_vec_size * sizeof(struct bio_vec)); |
500 | 529 | ||
501 | verity_prefetch_io(v, io); | 530 | verity_submit_prefetch(v, io); |
502 | 531 | ||
503 | generic_make_request(bio); | 532 | generic_make_request(bio); |
504 | 533 | ||
@@ -858,7 +887,7 @@ bad: | |||
858 | 887 | ||
859 | static struct target_type verity_target = { | 888 | static struct target_type verity_target = { |
860 | .name = "verity", | 889 | .name = "verity", |
861 | .version = {1, 1, 1}, | 890 | .version = {1, 2, 0}, |
862 | .module = THIS_MODULE, | 891 | .module = THIS_MODULE, |
863 | .ctr = verity_ctr, | 892 | .ctr = verity_ctr, |
864 | .dtr = verity_dtr, | 893 | .dtr = verity_dtr, |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7e469260fe5e..9a0bdad9ad8f 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -611,6 +611,7 @@ static void dec_pending(struct dm_io *io, int error) | |||
611 | queue_io(md, bio); | 611 | queue_io(md, bio); |
612 | } else { | 612 | } else { |
613 | /* done with normal IO or empty flush */ | 613 | /* done with normal IO or empty flush */ |
614 | trace_block_bio_complete(md->queue, bio, io_error); | ||
614 | bio_endio(bio, io_error); | 615 | bio_endio(bio, io_error); |
615 | } | 616 | } |
616 | } | 617 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index fcb878f88796..aeceedfc530b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7663,10 +7663,8 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7663 | removed++; | 7663 | removed++; |
7664 | } | 7664 | } |
7665 | } | 7665 | } |
7666 | if (removed) | 7666 | if (removed && mddev->kobj.sd) |
7667 | sysfs_notify(&mddev->kobj, NULL, | 7667 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
7668 | "degraded"); | ||
7669 | |||
7670 | 7668 | ||
7671 | rdev_for_each(rdev, mddev) { | 7669 | rdev_for_each(rdev, mddev) { |
7672 | if (rdev->raid_disk >= 0 && | 7670 | if (rdev->raid_disk >= 0 && |
diff --git a/drivers/md/md.h b/drivers/md/md.h index eca59c3074ef..d90fb1a879e1 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -506,7 +506,7 @@ static inline char * mdname (struct mddev * mddev) | |||
506 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | 506 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) |
507 | { | 507 | { |
508 | char nm[20]; | 508 | char nm[20]; |
509 | if (!test_bit(Replacement, &rdev->flags)) { | 509 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
510 | sprintf(nm, "rd%d", rdev->raid_disk); | 510 | sprintf(nm, "rd%d", rdev->raid_disk); |
511 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); | 511 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); |
512 | } else | 512 | } else |
@@ -516,7 +516,7 @@ static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | |||
516 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) | 516 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) |
517 | { | 517 | { |
518 | char nm[20]; | 518 | char nm[20]; |
519 | if (!test_bit(Replacement, &rdev->flags)) { | 519 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
520 | sprintf(nm, "rd%d", rdev->raid_disk); | 520 | sprintf(nm, "rd%d", rdev->raid_disk); |
521 | sysfs_remove_link(&mddev->kobj, nm); | 521 | sysfs_remove_link(&mddev->kobj, nm); |
522 | } | 522 | } |
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index c4f28133ef82..b88757cd0d1d 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
@@ -139,15 +139,8 @@ struct child { | |||
139 | struct btree_node *n; | 139 | struct btree_node *n; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | static struct dm_btree_value_type le64_type = { | 142 | static int init_child(struct dm_btree_info *info, struct dm_btree_value_type *vt, |
143 | .context = NULL, | 143 | struct btree_node *parent, |
144 | .size = sizeof(__le64), | ||
145 | .inc = NULL, | ||
146 | .dec = NULL, | ||
147 | .equal = NULL | ||
148 | }; | ||
149 | |||
150 | static int init_child(struct dm_btree_info *info, struct btree_node *parent, | ||
151 | unsigned index, struct child *result) | 144 | unsigned index, struct child *result) |
152 | { | 145 | { |
153 | int r, inc; | 146 | int r, inc; |
@@ -164,7 +157,7 @@ static int init_child(struct dm_btree_info *info, struct btree_node *parent, | |||
164 | result->n = dm_block_data(result->block); | 157 | result->n = dm_block_data(result->block); |
165 | 158 | ||
166 | if (inc) | 159 | if (inc) |
167 | inc_children(info->tm, result->n, &le64_type); | 160 | inc_children(info->tm, result->n, vt); |
168 | 161 | ||
169 | *((__le64 *) value_ptr(parent, index)) = | 162 | *((__le64 *) value_ptr(parent, index)) = |
170 | cpu_to_le64(dm_block_location(result->block)); | 163 | cpu_to_le64(dm_block_location(result->block)); |
@@ -236,7 +229,7 @@ static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, | |||
236 | } | 229 | } |
237 | 230 | ||
238 | static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | 231 | static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
239 | unsigned left_index) | 232 | struct dm_btree_value_type *vt, unsigned left_index) |
240 | { | 233 | { |
241 | int r; | 234 | int r; |
242 | struct btree_node *parent; | 235 | struct btree_node *parent; |
@@ -244,11 +237,11 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | |||
244 | 237 | ||
245 | parent = dm_block_data(shadow_current(s)); | 238 | parent = dm_block_data(shadow_current(s)); |
246 | 239 | ||
247 | r = init_child(info, parent, left_index, &left); | 240 | r = init_child(info, vt, parent, left_index, &left); |
248 | if (r) | 241 | if (r) |
249 | return r; | 242 | return r; |
250 | 243 | ||
251 | r = init_child(info, parent, left_index + 1, &right); | 244 | r = init_child(info, vt, parent, left_index + 1, &right); |
252 | if (r) { | 245 | if (r) { |
253 | exit_child(info, &left); | 246 | exit_child(info, &left); |
254 | return r; | 247 | return r; |
@@ -368,7 +361,7 @@ static void __rebalance3(struct dm_btree_info *info, struct btree_node *parent, | |||
368 | } | 361 | } |
369 | 362 | ||
370 | static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | 363 | static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
371 | unsigned left_index) | 364 | struct dm_btree_value_type *vt, unsigned left_index) |
372 | { | 365 | { |
373 | int r; | 366 | int r; |
374 | struct btree_node *parent = dm_block_data(shadow_current(s)); | 367 | struct btree_node *parent = dm_block_data(shadow_current(s)); |
@@ -377,17 +370,17 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | |||
377 | /* | 370 | /* |
378 | * FIXME: fill out an array? | 371 | * FIXME: fill out an array? |
379 | */ | 372 | */ |
380 | r = init_child(info, parent, left_index, &left); | 373 | r = init_child(info, vt, parent, left_index, &left); |
381 | if (r) | 374 | if (r) |
382 | return r; | 375 | return r; |
383 | 376 | ||
384 | r = init_child(info, parent, left_index + 1, ¢er); | 377 | r = init_child(info, vt, parent, left_index + 1, ¢er); |
385 | if (r) { | 378 | if (r) { |
386 | exit_child(info, &left); | 379 | exit_child(info, &left); |
387 | return r; | 380 | return r; |
388 | } | 381 | } |
389 | 382 | ||
390 | r = init_child(info, parent, left_index + 2, &right); | 383 | r = init_child(info, vt, parent, left_index + 2, &right); |
391 | if (r) { | 384 | if (r) { |
392 | exit_child(info, &left); | 385 | exit_child(info, &left); |
393 | exit_child(info, ¢er); | 386 | exit_child(info, ¢er); |
@@ -434,7 +427,8 @@ static int get_nr_entries(struct dm_transaction_manager *tm, | |||
434 | } | 427 | } |
435 | 428 | ||
436 | static int rebalance_children(struct shadow_spine *s, | 429 | static int rebalance_children(struct shadow_spine *s, |
437 | struct dm_btree_info *info, uint64_t key) | 430 | struct dm_btree_info *info, |
431 | struct dm_btree_value_type *vt, uint64_t key) | ||
438 | { | 432 | { |
439 | int i, r, has_left_sibling, has_right_sibling; | 433 | int i, r, has_left_sibling, has_right_sibling; |
440 | uint32_t child_entries; | 434 | uint32_t child_entries; |
@@ -472,13 +466,13 @@ static int rebalance_children(struct shadow_spine *s, | |||
472 | has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); | 466 | has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); |
473 | 467 | ||
474 | if (!has_left_sibling) | 468 | if (!has_left_sibling) |
475 | r = rebalance2(s, info, i); | 469 | r = rebalance2(s, info, vt, i); |
476 | 470 | ||
477 | else if (!has_right_sibling) | 471 | else if (!has_right_sibling) |
478 | r = rebalance2(s, info, i - 1); | 472 | r = rebalance2(s, info, vt, i - 1); |
479 | 473 | ||
480 | else | 474 | else |
481 | r = rebalance3(s, info, i - 1); | 475 | r = rebalance3(s, info, vt, i - 1); |
482 | 476 | ||
483 | return r; | 477 | return r; |
484 | } | 478 | } |
@@ -529,7 +523,7 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
529 | if (le32_to_cpu(n->header.flags) & LEAF_NODE) | 523 | if (le32_to_cpu(n->header.flags) & LEAF_NODE) |
530 | return do_leaf(n, key, index); | 524 | return do_leaf(n, key, index); |
531 | 525 | ||
532 | r = rebalance_children(s, info, key); | 526 | r = rebalance_children(s, info, vt, key); |
533 | if (r) | 527 | if (r) |
534 | break; | 528 | break; |
535 | 529 | ||
@@ -550,6 +544,14 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
550 | return r; | 544 | return r; |
551 | } | 545 | } |
552 | 546 | ||
547 | static struct dm_btree_value_type le64_type = { | ||
548 | .context = NULL, | ||
549 | .size = sizeof(__le64), | ||
550 | .inc = NULL, | ||
551 | .dec = NULL, | ||
552 | .equal = NULL | ||
553 | }; | ||
554 | |||
553 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, | 555 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, |
554 | uint64_t *keys, dm_block_t *new_root) | 556 | uint64_t *keys, dm_block_t *new_root) |
555 | { | 557 | { |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3ee2912889e7..f4e87bfc7567 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -184,6 +184,8 @@ static void return_io(struct bio *return_bi) | |||
184 | return_bi = bi->bi_next; | 184 | return_bi = bi->bi_next; |
185 | bi->bi_next = NULL; | 185 | bi->bi_next = NULL; |
186 | bi->bi_size = 0; | 186 | bi->bi_size = 0; |
187 | trace_block_bio_complete(bdev_get_queue(bi->bi_bdev), | ||
188 | bi, 0); | ||
187 | bio_endio(bi, 0); | 189 | bio_endio(bi, 0); |
188 | bi = return_bi; | 190 | bi = return_bi; |
189 | } | 191 | } |
@@ -671,9 +673,11 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
671 | bi->bi_next = NULL; | 673 | bi->bi_next = NULL; |
672 | if (rrdev) | 674 | if (rrdev) |
673 | set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); | 675 | set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); |
674 | trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), | 676 | |
675 | bi, disk_devt(conf->mddev->gendisk), | 677 | if (conf->mddev->gendisk) |
676 | sh->dev[i].sector); | 678 | trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), |
679 | bi, disk_devt(conf->mddev->gendisk), | ||
680 | sh->dev[i].sector); | ||
677 | generic_make_request(bi); | 681 | generic_make_request(bi); |
678 | } | 682 | } |
679 | if (rrdev) { | 683 | if (rrdev) { |
@@ -701,9 +705,10 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
701 | rbi->bi_io_vec[0].bv_offset = 0; | 705 | rbi->bi_io_vec[0].bv_offset = 0; |
702 | rbi->bi_size = STRIPE_SIZE; | 706 | rbi->bi_size = STRIPE_SIZE; |
703 | rbi->bi_next = NULL; | 707 | rbi->bi_next = NULL; |
704 | trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), | 708 | if (conf->mddev->gendisk) |
705 | rbi, disk_devt(conf->mddev->gendisk), | 709 | trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), |
706 | sh->dev[i].sector); | 710 | rbi, disk_devt(conf->mddev->gendisk), |
711 | sh->dev[i].sector); | ||
707 | generic_make_request(rbi); | 712 | generic_make_request(rbi); |
708 | } | 713 | } |
709 | if (!rdev && !rrdev) { | 714 | if (!rdev && !rrdev) { |
@@ -2280,17 +2285,6 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2280 | int level = conf->level; | 2285 | int level = conf->level; |
2281 | 2286 | ||
2282 | if (rcw) { | 2287 | if (rcw) { |
2283 | /* if we are not expanding this is a proper write request, and | ||
2284 | * there will be bios with new data to be drained into the | ||
2285 | * stripe cache | ||
2286 | */ | ||
2287 | if (!expand) { | ||
2288 | sh->reconstruct_state = reconstruct_state_drain_run; | ||
2289 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2290 | } else | ||
2291 | sh->reconstruct_state = reconstruct_state_run; | ||
2292 | |||
2293 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2294 | 2288 | ||
2295 | for (i = disks; i--; ) { | 2289 | for (i = disks; i--; ) { |
2296 | struct r5dev *dev = &sh->dev[i]; | 2290 | struct r5dev *dev = &sh->dev[i]; |
@@ -2303,6 +2297,21 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2303 | s->locked++; | 2297 | s->locked++; |
2304 | } | 2298 | } |
2305 | } | 2299 | } |
2300 | /* if we are not expanding this is a proper write request, and | ||
2301 | * there will be bios with new data to be drained into the | ||
2302 | * stripe cache | ||
2303 | */ | ||
2304 | if (!expand) { | ||
2305 | if (!s->locked) | ||
2306 | /* False alarm, nothing to do */ | ||
2307 | return; | ||
2308 | sh->reconstruct_state = reconstruct_state_drain_run; | ||
2309 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2310 | } else | ||
2311 | sh->reconstruct_state = reconstruct_state_run; | ||
2312 | |||
2313 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2314 | |||
2306 | if (s->locked + conf->max_degraded == disks) | 2315 | if (s->locked + conf->max_degraded == disks) |
2307 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) | 2316 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) |
2308 | atomic_inc(&conf->pending_full_writes); | 2317 | atomic_inc(&conf->pending_full_writes); |
@@ -2311,11 +2320,6 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2311 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || | 2320 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || |
2312 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); | 2321 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); |
2313 | 2322 | ||
2314 | sh->reconstruct_state = reconstruct_state_prexor_drain_run; | ||
2315 | set_bit(STRIPE_OP_PREXOR, &s->ops_request); | ||
2316 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2317 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2318 | |||
2319 | for (i = disks; i--; ) { | 2323 | for (i = disks; i--; ) { |
2320 | struct r5dev *dev = &sh->dev[i]; | 2324 | struct r5dev *dev = &sh->dev[i]; |
2321 | if (i == pd_idx) | 2325 | if (i == pd_idx) |
@@ -2330,6 +2334,13 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2330 | s->locked++; | 2334 | s->locked++; |
2331 | } | 2335 | } |
2332 | } | 2336 | } |
2337 | if (!s->locked) | ||
2338 | /* False alarm - nothing to do */ | ||
2339 | return; | ||
2340 | sh->reconstruct_state = reconstruct_state_prexor_drain_run; | ||
2341 | set_bit(STRIPE_OP_PREXOR, &s->ops_request); | ||
2342 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2343 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2333 | } | 2344 | } |
2334 | 2345 | ||
2335 | /* keep the parity disk(s) locked while asynchronous operations | 2346 | /* keep the parity disk(s) locked while asynchronous operations |
@@ -2564,6 +2575,8 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh, | |||
2564 | int i; | 2575 | int i; |
2565 | 2576 | ||
2566 | clear_bit(STRIPE_SYNCING, &sh->state); | 2577 | clear_bit(STRIPE_SYNCING, &sh->state); |
2578 | if (test_and_clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags)) | ||
2579 | wake_up(&conf->wait_for_overlap); | ||
2567 | s->syncing = 0; | 2580 | s->syncing = 0; |
2568 | s->replacing = 0; | 2581 | s->replacing = 0; |
2569 | /* There is nothing more to do for sync/check/repair. | 2582 | /* There is nothing more to do for sync/check/repair. |
@@ -2737,6 +2750,7 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
2737 | { | 2750 | { |
2738 | int i; | 2751 | int i; |
2739 | struct r5dev *dev; | 2752 | struct r5dev *dev; |
2753 | int discard_pending = 0; | ||
2740 | 2754 | ||
2741 | for (i = disks; i--; ) | 2755 | for (i = disks; i--; ) |
2742 | if (sh->dev[i].written) { | 2756 | if (sh->dev[i].written) { |
@@ -2765,9 +2779,23 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
2765 | STRIPE_SECTORS, | 2779 | STRIPE_SECTORS, |
2766 | !test_bit(STRIPE_DEGRADED, &sh->state), | 2780 | !test_bit(STRIPE_DEGRADED, &sh->state), |
2767 | 0); | 2781 | 0); |
2768 | } | 2782 | } else if (test_bit(R5_Discard, &dev->flags)) |
2769 | } else if (test_bit(R5_Discard, &sh->dev[i].flags)) | 2783 | discard_pending = 1; |
2770 | clear_bit(R5_Discard, &sh->dev[i].flags); | 2784 | } |
2785 | if (!discard_pending && | ||
2786 | test_bit(R5_Discard, &sh->dev[sh->pd_idx].flags)) { | ||
2787 | clear_bit(R5_Discard, &sh->dev[sh->pd_idx].flags); | ||
2788 | clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags); | ||
2789 | if (sh->qd_idx >= 0) { | ||
2790 | clear_bit(R5_Discard, &sh->dev[sh->qd_idx].flags); | ||
2791 | clear_bit(R5_UPTODATE, &sh->dev[sh->qd_idx].flags); | ||
2792 | } | ||
2793 | /* now that discard is done we can proceed with any sync */ | ||
2794 | clear_bit(STRIPE_DISCARD, &sh->state); | ||
2795 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) | ||
2796 | set_bit(STRIPE_HANDLE, &sh->state); | ||
2797 | |||
2798 | } | ||
2771 | 2799 | ||
2772 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) | 2800 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) |
2773 | if (atomic_dec_and_test(&conf->pending_full_writes)) | 2801 | if (atomic_dec_and_test(&conf->pending_full_writes)) |
@@ -2826,8 +2854,10 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2826 | set_bit(STRIPE_HANDLE, &sh->state); | 2854 | set_bit(STRIPE_HANDLE, &sh->state); |
2827 | if (rmw < rcw && rmw > 0) { | 2855 | if (rmw < rcw && rmw > 0) { |
2828 | /* prefer read-modify-write, but need to get some data */ | 2856 | /* prefer read-modify-write, but need to get some data */ |
2829 | blk_add_trace_msg(conf->mddev->queue, "raid5 rmw %llu %d", | 2857 | if (conf->mddev->queue) |
2830 | (unsigned long long)sh->sector, rmw); | 2858 | blk_add_trace_msg(conf->mddev->queue, |
2859 | "raid5 rmw %llu %d", | ||
2860 | (unsigned long long)sh->sector, rmw); | ||
2831 | for (i = disks; i--; ) { | 2861 | for (i = disks; i--; ) { |
2832 | struct r5dev *dev = &sh->dev[i]; | 2862 | struct r5dev *dev = &sh->dev[i]; |
2833 | if ((dev->towrite || i == sh->pd_idx) && | 2863 | if ((dev->towrite || i == sh->pd_idx) && |
@@ -2877,7 +2907,7 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2877 | } | 2907 | } |
2878 | } | 2908 | } |
2879 | } | 2909 | } |
2880 | if (rcw) | 2910 | if (rcw && conf->mddev->queue) |
2881 | blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d", | 2911 | blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d", |
2882 | (unsigned long long)sh->sector, | 2912 | (unsigned long long)sh->sector, |
2883 | rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); | 2913 | rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); |
@@ -3417,9 +3447,15 @@ static void handle_stripe(struct stripe_head *sh) | |||
3417 | return; | 3447 | return; |
3418 | } | 3448 | } |
3419 | 3449 | ||
3420 | if (test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | 3450 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { |
3421 | set_bit(STRIPE_SYNCING, &sh->state); | 3451 | spin_lock(&sh->stripe_lock); |
3422 | clear_bit(STRIPE_INSYNC, &sh->state); | 3452 | /* Cannot process 'sync' concurrently with 'discard' */ |
3453 | if (!test_bit(STRIPE_DISCARD, &sh->state) && | ||
3454 | test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | ||
3455 | set_bit(STRIPE_SYNCING, &sh->state); | ||
3456 | clear_bit(STRIPE_INSYNC, &sh->state); | ||
3457 | } | ||
3458 | spin_unlock(&sh->stripe_lock); | ||
3423 | } | 3459 | } |
3424 | clear_bit(STRIPE_DELAYED, &sh->state); | 3460 | clear_bit(STRIPE_DELAYED, &sh->state); |
3425 | 3461 | ||
@@ -3579,6 +3615,8 @@ static void handle_stripe(struct stripe_head *sh) | |||
3579 | test_bit(STRIPE_INSYNC, &sh->state)) { | 3615 | test_bit(STRIPE_INSYNC, &sh->state)) { |
3580 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); | 3616 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); |
3581 | clear_bit(STRIPE_SYNCING, &sh->state); | 3617 | clear_bit(STRIPE_SYNCING, &sh->state); |
3618 | if (test_and_clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags)) | ||
3619 | wake_up(&conf->wait_for_overlap); | ||
3582 | } | 3620 | } |
3583 | 3621 | ||
3584 | /* If the failed drives are just a ReadError, then we might need | 3622 | /* If the failed drives are just a ReadError, then we might need |
@@ -3878,6 +3916,8 @@ static void raid5_align_endio(struct bio *bi, int error) | |||
3878 | rdev_dec_pending(rdev, conf->mddev); | 3916 | rdev_dec_pending(rdev, conf->mddev); |
3879 | 3917 | ||
3880 | if (!error && uptodate) { | 3918 | if (!error && uptodate) { |
3919 | trace_block_bio_complete(bdev_get_queue(raid_bi->bi_bdev), | ||
3920 | raid_bi, 0); | ||
3881 | bio_endio(raid_bi, 0); | 3921 | bio_endio(raid_bi, 0); |
3882 | if (atomic_dec_and_test(&conf->active_aligned_reads)) | 3922 | if (atomic_dec_and_test(&conf->active_aligned_reads)) |
3883 | wake_up(&conf->wait_for_stripe); | 3923 | wake_up(&conf->wait_for_stripe); |
@@ -3982,9 +4022,10 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3982 | atomic_inc(&conf->active_aligned_reads); | 4022 | atomic_inc(&conf->active_aligned_reads); |
3983 | spin_unlock_irq(&conf->device_lock); | 4023 | spin_unlock_irq(&conf->device_lock); |
3984 | 4024 | ||
3985 | trace_block_bio_remap(bdev_get_queue(align_bi->bi_bdev), | 4025 | if (mddev->gendisk) |
3986 | align_bi, disk_devt(mddev->gendisk), | 4026 | trace_block_bio_remap(bdev_get_queue(align_bi->bi_bdev), |
3987 | raid_bio->bi_sector); | 4027 | align_bi, disk_devt(mddev->gendisk), |
4028 | raid_bio->bi_sector); | ||
3988 | generic_make_request(align_bi); | 4029 | generic_make_request(align_bi); |
3989 | return 1; | 4030 | return 1; |
3990 | } else { | 4031 | } else { |
@@ -4078,7 +4119,8 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule) | |||
4078 | } | 4119 | } |
4079 | spin_unlock_irq(&conf->device_lock); | 4120 | spin_unlock_irq(&conf->device_lock); |
4080 | } | 4121 | } |
4081 | trace_block_unplug(mddev->queue, cnt, !from_schedule); | 4122 | if (mddev->queue) |
4123 | trace_block_unplug(mddev->queue, cnt, !from_schedule); | ||
4082 | kfree(cb); | 4124 | kfree(cb); |
4083 | } | 4125 | } |
4084 | 4126 | ||
@@ -4141,6 +4183,13 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) | |||
4141 | sh = get_active_stripe(conf, logical_sector, 0, 0, 0); | 4183 | sh = get_active_stripe(conf, logical_sector, 0, 0, 0); |
4142 | prepare_to_wait(&conf->wait_for_overlap, &w, | 4184 | prepare_to_wait(&conf->wait_for_overlap, &w, |
4143 | TASK_UNINTERRUPTIBLE); | 4185 | TASK_UNINTERRUPTIBLE); |
4186 | set_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags); | ||
4187 | if (test_bit(STRIPE_SYNCING, &sh->state)) { | ||
4188 | release_stripe(sh); | ||
4189 | schedule(); | ||
4190 | goto again; | ||
4191 | } | ||
4192 | clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags); | ||
4144 | spin_lock_irq(&sh->stripe_lock); | 4193 | spin_lock_irq(&sh->stripe_lock); |
4145 | for (d = 0; d < conf->raid_disks; d++) { | 4194 | for (d = 0; d < conf->raid_disks; d++) { |
4146 | if (d == sh->pd_idx || d == sh->qd_idx) | 4195 | if (d == sh->pd_idx || d == sh->qd_idx) |
@@ -4153,6 +4202,7 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) | |||
4153 | goto again; | 4202 | goto again; |
4154 | } | 4203 | } |
4155 | } | 4204 | } |
4205 | set_bit(STRIPE_DISCARD, &sh->state); | ||
4156 | finish_wait(&conf->wait_for_overlap, &w); | 4206 | finish_wait(&conf->wait_for_overlap, &w); |
4157 | for (d = 0; d < conf->raid_disks; d++) { | 4207 | for (d = 0; d < conf->raid_disks; d++) { |
4158 | if (d == sh->pd_idx || d == sh->qd_idx) | 4208 | if (d == sh->pd_idx || d == sh->qd_idx) |
@@ -4336,6 +4386,8 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4336 | if ( rw == WRITE ) | 4386 | if ( rw == WRITE ) |
4337 | md_write_end(mddev); | 4387 | md_write_end(mddev); |
4338 | 4388 | ||
4389 | trace_block_bio_complete(bdev_get_queue(bi->bi_bdev), | ||
4390 | bi, 0); | ||
4339 | bio_endio(bi, 0); | 4391 | bio_endio(bi, 0); |
4340 | } | 4392 | } |
4341 | } | 4393 | } |
@@ -4712,8 +4764,11 @@ static int retry_aligned_read(struct r5conf *conf, struct bio *raid_bio) | |||
4712 | handled++; | 4764 | handled++; |
4713 | } | 4765 | } |
4714 | remaining = raid5_dec_bi_active_stripes(raid_bio); | 4766 | remaining = raid5_dec_bi_active_stripes(raid_bio); |
4715 | if (remaining == 0) | 4767 | if (remaining == 0) { |
4768 | trace_block_bio_complete(bdev_get_queue(raid_bio->bi_bdev), | ||
4769 | raid_bio, 0); | ||
4716 | bio_endio(raid_bio, 0); | 4770 | bio_endio(raid_bio, 0); |
4771 | } | ||
4717 | if (atomic_dec_and_test(&conf->active_aligned_reads)) | 4772 | if (atomic_dec_and_test(&conf->active_aligned_reads)) |
4718 | wake_up(&conf->wait_for_stripe); | 4773 | wake_up(&conf->wait_for_stripe); |
4719 | return handled; | 4774 | return handled; |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 18b2c4a8a1fd..b0b663b119a8 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -221,10 +221,6 @@ struct stripe_head { | |||
221 | struct stripe_operations { | 221 | struct stripe_operations { |
222 | int target, target2; | 222 | int target, target2; |
223 | enum sum_check_flags zero_sum_result; | 223 | enum sum_check_flags zero_sum_result; |
224 | #ifdef CONFIG_MULTICORE_RAID456 | ||
225 | unsigned long request; | ||
226 | wait_queue_head_t wait_for_ops; | ||
227 | #endif | ||
228 | } ops; | 224 | } ops; |
229 | struct r5dev { | 225 | struct r5dev { |
230 | /* rreq and rvec are used for the replacement device when | 226 | /* rreq and rvec are used for the replacement device when |
@@ -323,6 +319,7 @@ enum { | |||
323 | STRIPE_COMPUTE_RUN, | 319 | STRIPE_COMPUTE_RUN, |
324 | STRIPE_OPS_REQ_PENDING, | 320 | STRIPE_OPS_REQ_PENDING, |
325 | STRIPE_ON_UNPLUG_LIST, | 321 | STRIPE_ON_UNPLUG_LIST, |
322 | STRIPE_DISCARD, | ||
326 | }; | 323 | }; |
327 | 324 | ||
328 | /* | 325 | /* |
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c index d4e7567b367c..0b899cb6cda1 100644 --- a/drivers/media/i2c/m5mols/m5mols_core.c +++ b/drivers/media/i2c/m5mols/m5mols_core.c | |||
@@ -724,7 +724,7 @@ static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) | |||
724 | if (enable) { | 724 | if (enable) { |
725 | if (is_code(code, M5MOLS_RESTYPE_MONITOR)) | 725 | if (is_code(code, M5MOLS_RESTYPE_MONITOR)) |
726 | ret = m5mols_start_monitor(info); | 726 | ret = m5mols_start_monitor(info); |
727 | if (is_code(code, M5MOLS_RESTYPE_CAPTURE)) | 727 | else if (is_code(code, M5MOLS_RESTYPE_CAPTURE)) |
728 | ret = m5mols_start_capture(info); | 728 | ret = m5mols_start_capture(info); |
729 | else | 729 | else |
730 | ret = -EINVAL; | 730 | ret = -EINVAL; |
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index ccd18e4ee789..54579e4c740b 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c | |||
@@ -250,17 +250,19 @@ static u8 SRAM_Table[][60] = | |||
250 | vdelay start of active video in 2 * field lines relative to | 250 | vdelay start of active video in 2 * field lines relative to |
251 | trailing edge of /VRESET pulse (VDELAY register). | 251 | trailing edge of /VRESET pulse (VDELAY register). |
252 | sheight height of active video in 2 * field lines. | 252 | sheight height of active video in 2 * field lines. |
253 | extraheight Added to sheight for cropcap.bounds.height only | ||
253 | videostart0 ITU-R frame line number of the line corresponding | 254 | videostart0 ITU-R frame line number of the line corresponding |
254 | to vdelay in the first field. */ | 255 | to vdelay in the first field. */ |
255 | #define CROPCAP(minhdelayx1, hdelayx1, swidth, totalwidth, sqwidth, \ | 256 | #define CROPCAP(minhdelayx1, hdelayx1, swidth, totalwidth, sqwidth, \ |
256 | vdelay, sheight, videostart0) \ | 257 | vdelay, sheight, extraheight, videostart0) \ |
257 | .cropcap.bounds.left = minhdelayx1, \ | 258 | .cropcap.bounds.left = minhdelayx1, \ |
258 | /* * 2 because vertically we count field lines times two, */ \ | 259 | /* * 2 because vertically we count field lines times two, */ \ |
259 | /* e.g. 23 * 2 to 23 * 2 + 576 in PAL-BGHI defrect. */ \ | 260 | /* e.g. 23 * 2 to 23 * 2 + 576 in PAL-BGHI defrect. */ \ |
260 | .cropcap.bounds.top = (videostart0) * 2 - (vdelay) + MIN_VDELAY, \ | 261 | .cropcap.bounds.top = (videostart0) * 2 - (vdelay) + MIN_VDELAY, \ |
261 | /* 4 is a safety margin at the end of the line. */ \ | 262 | /* 4 is a safety margin at the end of the line. */ \ |
262 | .cropcap.bounds.width = (totalwidth) - (minhdelayx1) - 4, \ | 263 | .cropcap.bounds.width = (totalwidth) - (minhdelayx1) - 4, \ |
263 | .cropcap.bounds.height = (sheight) + (vdelay) - MIN_VDELAY, \ | 264 | .cropcap.bounds.height = (sheight) + (extraheight) + (vdelay) - \ |
265 | MIN_VDELAY, \ | ||
264 | .cropcap.defrect.left = hdelayx1, \ | 266 | .cropcap.defrect.left = hdelayx1, \ |
265 | .cropcap.defrect.top = (videostart0) * 2, \ | 267 | .cropcap.defrect.top = (videostart0) * 2, \ |
266 | .cropcap.defrect.width = swidth, \ | 268 | .cropcap.defrect.width = swidth, \ |
@@ -301,9 +303,10 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
301 | /* totalwidth */ 1135, | 303 | /* totalwidth */ 1135, |
302 | /* sqwidth */ 944, | 304 | /* sqwidth */ 944, |
303 | /* vdelay */ 0x20, | 305 | /* vdelay */ 0x20, |
304 | /* bt878 (and bt848?) can capture another | 306 | /* sheight */ 576, |
305 | line below active video. */ | 307 | /* bt878 (and bt848?) can capture another |
306 | /* sheight */ (576 + 2) + 0x20 - 2, | 308 | line below active video. */ |
309 | /* extraheight */ 2, | ||
307 | /* videostart0 */ 23) | 310 | /* videostart0 */ 23) |
308 | },{ | 311 | },{ |
309 | .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, | 312 | .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, |
@@ -330,6 +333,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
330 | /* sqwidth */ 780, | 333 | /* sqwidth */ 780, |
331 | /* vdelay */ 0x1a, | 334 | /* vdelay */ 0x1a, |
332 | /* sheight */ 480, | 335 | /* sheight */ 480, |
336 | /* extraheight */ 0, | ||
333 | /* videostart0 */ 23) | 337 | /* videostart0 */ 23) |
334 | },{ | 338 | },{ |
335 | .v4l2_id = V4L2_STD_SECAM, | 339 | .v4l2_id = V4L2_STD_SECAM, |
@@ -355,6 +359,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
355 | /* sqwidth */ 944, | 359 | /* sqwidth */ 944, |
356 | /* vdelay */ 0x20, | 360 | /* vdelay */ 0x20, |
357 | /* sheight */ 576, | 361 | /* sheight */ 576, |
362 | /* extraheight */ 0, | ||
358 | /* videostart0 */ 23) | 363 | /* videostart0 */ 23) |
359 | },{ | 364 | },{ |
360 | .v4l2_id = V4L2_STD_PAL_Nc, | 365 | .v4l2_id = V4L2_STD_PAL_Nc, |
@@ -380,6 +385,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
380 | /* sqwidth */ 780, | 385 | /* sqwidth */ 780, |
381 | /* vdelay */ 0x1a, | 386 | /* vdelay */ 0x1a, |
382 | /* sheight */ 576, | 387 | /* sheight */ 576, |
388 | /* extraheight */ 0, | ||
383 | /* videostart0 */ 23) | 389 | /* videostart0 */ 23) |
384 | },{ | 390 | },{ |
385 | .v4l2_id = V4L2_STD_PAL_M, | 391 | .v4l2_id = V4L2_STD_PAL_M, |
@@ -405,6 +411,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
405 | /* sqwidth */ 780, | 411 | /* sqwidth */ 780, |
406 | /* vdelay */ 0x1a, | 412 | /* vdelay */ 0x1a, |
407 | /* sheight */ 480, | 413 | /* sheight */ 480, |
414 | /* extraheight */ 0, | ||
408 | /* videostart0 */ 23) | 415 | /* videostart0 */ 23) |
409 | },{ | 416 | },{ |
410 | .v4l2_id = V4L2_STD_PAL_N, | 417 | .v4l2_id = V4L2_STD_PAL_N, |
@@ -430,6 +437,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
430 | /* sqwidth */ 944, | 437 | /* sqwidth */ 944, |
431 | /* vdelay */ 0x20, | 438 | /* vdelay */ 0x20, |
432 | /* sheight */ 576, | 439 | /* sheight */ 576, |
440 | /* extraheight */ 0, | ||
433 | /* videostart0 */ 23) | 441 | /* videostart0 */ 23) |
434 | },{ | 442 | },{ |
435 | .v4l2_id = V4L2_STD_NTSC_M_JP, | 443 | .v4l2_id = V4L2_STD_NTSC_M_JP, |
@@ -455,6 +463,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
455 | /* sqwidth */ 780, | 463 | /* sqwidth */ 780, |
456 | /* vdelay */ 0x16, | 464 | /* vdelay */ 0x16, |
457 | /* sheight */ 480, | 465 | /* sheight */ 480, |
466 | /* extraheight */ 0, | ||
458 | /* videostart0 */ 23) | 467 | /* videostart0 */ 23) |
459 | },{ | 468 | },{ |
460 | /* that one hopefully works with the strange timing | 469 | /* that one hopefully works with the strange timing |
@@ -484,6 +493,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
484 | /* sqwidth */ 944, | 493 | /* sqwidth */ 944, |
485 | /* vdelay */ 0x1a, | 494 | /* vdelay */ 0x1a, |
486 | /* sheight */ 480, | 495 | /* sheight */ 480, |
496 | /* extraheight */ 0, | ||
487 | /* videostart0 */ 23) | 497 | /* videostart0 */ 23) |
488 | } | 498 | } |
489 | }; | 499 | }; |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 05d7b6333461..a0639e779973 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
@@ -204,7 +204,7 @@ config VIDEO_SAMSUNG_EXYNOS_GSC | |||
204 | 204 | ||
205 | config VIDEO_SH_VEU | 205 | config VIDEO_SH_VEU |
206 | tristate "SuperH VEU mem2mem video processing driver" | 206 | tristate "SuperH VEU mem2mem video processing driver" |
207 | depends on VIDEO_DEV && VIDEO_V4L2 | 207 | depends on VIDEO_DEV && VIDEO_V4L2 && GENERIC_HARDIRQS |
208 | select VIDEOBUF2_DMA_CONTIG | 208 | select VIDEOBUF2_DMA_CONTIG |
209 | select V4L2_MEM2MEM_DEV | 209 | select V4L2_MEM2MEM_DEV |
210 | help | 210 | help |
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 82d9f6ac12f3..33b5ffc8d66d 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c | |||
@@ -1054,16 +1054,18 @@ static int gsc_m2m_suspend(struct gsc_dev *gsc) | |||
1054 | 1054 | ||
1055 | static int gsc_m2m_resume(struct gsc_dev *gsc) | 1055 | static int gsc_m2m_resume(struct gsc_dev *gsc) |
1056 | { | 1056 | { |
1057 | struct gsc_ctx *ctx; | ||
1057 | unsigned long flags; | 1058 | unsigned long flags; |
1058 | 1059 | ||
1059 | spin_lock_irqsave(&gsc->slock, flags); | 1060 | spin_lock_irqsave(&gsc->slock, flags); |
1060 | /* Clear for full H/W setup in first run after resume */ | 1061 | /* Clear for full H/W setup in first run after resume */ |
1062 | ctx = gsc->m2m.ctx; | ||
1061 | gsc->m2m.ctx = NULL; | 1063 | gsc->m2m.ctx = NULL; |
1062 | spin_unlock_irqrestore(&gsc->slock, flags); | 1064 | spin_unlock_irqrestore(&gsc->slock, flags); |
1063 | 1065 | ||
1064 | if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state)) | 1066 | if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state)) |
1065 | gsc_m2m_job_finish(gsc->m2m.ctx, | 1067 | gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR); |
1066 | VB2_BUF_STATE_ERROR); | 1068 | |
1067 | return 0; | 1069 | return 0; |
1068 | } | 1070 | } |
1069 | 1071 | ||
@@ -1204,7 +1206,7 @@ static int gsc_resume(struct device *dev) | |||
1204 | /* Do not resume if the device was idle before system suspend */ | 1206 | /* Do not resume if the device was idle before system suspend */ |
1205 | spin_lock_irqsave(&gsc->slock, flags); | 1207 | spin_lock_irqsave(&gsc->slock, flags); |
1206 | if (!test_and_clear_bit(ST_SUSPEND, &gsc->state) || | 1208 | if (!test_and_clear_bit(ST_SUSPEND, &gsc->state) || |
1207 | !gsc_m2m_active(gsc)) { | 1209 | !gsc_m2m_opened(gsc)) { |
1208 | spin_unlock_irqrestore(&gsc->slock, flags); | 1210 | spin_unlock_irqrestore(&gsc->slock, flags); |
1209 | return 0; | 1211 | return 0; |
1210 | } | 1212 | } |
diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c index e3916bde45cf..0f513dd19f86 100644 --- a/drivers/media/platform/s5p-fimc/fimc-core.c +++ b/drivers/media/platform/s5p-fimc/fimc-core.c | |||
@@ -850,16 +850,18 @@ static int fimc_m2m_suspend(struct fimc_dev *fimc) | |||
850 | 850 | ||
851 | static int fimc_m2m_resume(struct fimc_dev *fimc) | 851 | static int fimc_m2m_resume(struct fimc_dev *fimc) |
852 | { | 852 | { |
853 | struct fimc_ctx *ctx; | ||
853 | unsigned long flags; | 854 | unsigned long flags; |
854 | 855 | ||
855 | spin_lock_irqsave(&fimc->slock, flags); | 856 | spin_lock_irqsave(&fimc->slock, flags); |
856 | /* Clear for full H/W setup in first run after resume */ | 857 | /* Clear for full H/W setup in first run after resume */ |
858 | ctx = fimc->m2m.ctx; | ||
857 | fimc->m2m.ctx = NULL; | 859 | fimc->m2m.ctx = NULL; |
858 | spin_unlock_irqrestore(&fimc->slock, flags); | 860 | spin_unlock_irqrestore(&fimc->slock, flags); |
859 | 861 | ||
860 | if (test_and_clear_bit(ST_M2M_SUSPENDED, &fimc->state)) | 862 | if (test_and_clear_bit(ST_M2M_SUSPENDED, &fimc->state)) |
861 | fimc_m2m_job_finish(fimc->m2m.ctx, | 863 | fimc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR); |
862 | VB2_BUF_STATE_ERROR); | 864 | |
863 | return 0; | 865 | return 0; |
864 | } | 866 | } |
865 | 867 | ||
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite-reg.c b/drivers/media/platform/s5p-fimc/fimc-lite-reg.c index f0af0754a7b4..ac9663ce2a49 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite-reg.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite-reg.c | |||
@@ -128,10 +128,10 @@ static const u32 src_pixfmt_map[8][3] = { | |||
128 | void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f) | 128 | void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f) |
129 | { | 129 | { |
130 | enum v4l2_mbus_pixelcode pixelcode = dev->fmt->mbus_code; | 130 | enum v4l2_mbus_pixelcode pixelcode = dev->fmt->mbus_code; |
131 | unsigned int i = ARRAY_SIZE(src_pixfmt_map); | 131 | int i = ARRAY_SIZE(src_pixfmt_map); |
132 | u32 cfg; | 132 | u32 cfg; |
133 | 133 | ||
134 | while (i-- >= 0) { | 134 | while (--i >= 0) { |
135 | if (src_pixfmt_map[i][0] == pixelcode) | 135 | if (src_pixfmt_map[i][0] == pixelcode) |
136 | break; | 136 | break; |
137 | } | 137 | } |
@@ -224,9 +224,9 @@ static void flite_hw_set_out_order(struct fimc_lite *dev, struct flite_frame *f) | |||
224 | { V4L2_MBUS_FMT_VYUY8_2X8, FLITE_REG_CIODMAFMT_CRYCBY }, | 224 | { V4L2_MBUS_FMT_VYUY8_2X8, FLITE_REG_CIODMAFMT_CRYCBY }, |
225 | }; | 225 | }; |
226 | u32 cfg = readl(dev->regs + FLITE_REG_CIODMAFMT); | 226 | u32 cfg = readl(dev->regs + FLITE_REG_CIODMAFMT); |
227 | unsigned int i = ARRAY_SIZE(pixcode); | 227 | int i = ARRAY_SIZE(pixcode); |
228 | 228 | ||
229 | while (i-- >= 0) | 229 | while (--i >= 0) |
230 | if (pixcode[i][0] == dev->fmt->mbus_code) | 230 | if (pixcode[i][0] == dev->fmt->mbus_code) |
231 | break; | 231 | break; |
232 | cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK; | 232 | cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK; |
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c index bfc4206935c8..bbc35de7db27 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite.c | |||
@@ -1408,6 +1408,7 @@ static const struct v4l2_ctrl_config fimc_lite_ctrl = { | |||
1408 | .id = V4L2_CTRL_CLASS_USER | 0x1001, | 1408 | .id = V4L2_CTRL_CLASS_USER | 0x1001, |
1409 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 1409 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
1410 | .name = "Test Pattern 640x480", | 1410 | .name = "Test Pattern 640x480", |
1411 | .step = 1, | ||
1411 | }; | 1412 | }; |
1412 | 1413 | ||
1413 | static int fimc_lite_create_capture_subdev(struct fimc_lite *fimc) | 1414 | static int fimc_lite_create_capture_subdev(struct fimc_lite *fimc) |
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index a17fcb2d5d41..cd38d708ab58 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c | |||
@@ -827,7 +827,7 @@ static int fimc_md_link_notify(struct media_pad *source, | |||
827 | struct fimc_pipeline *pipeline; | 827 | struct fimc_pipeline *pipeline; |
828 | struct v4l2_subdev *sd; | 828 | struct v4l2_subdev *sd; |
829 | struct mutex *lock; | 829 | struct mutex *lock; |
830 | int ret = 0; | 830 | int i, ret = 0; |
831 | int ref_count; | 831 | int ref_count; |
832 | 832 | ||
833 | if (media_entity_type(sink->entity) != MEDIA_ENT_T_V4L2_SUBDEV) | 833 | if (media_entity_type(sink->entity) != MEDIA_ENT_T_V4L2_SUBDEV) |
@@ -854,29 +854,28 @@ static int fimc_md_link_notify(struct media_pad *source, | |||
854 | return 0; | 854 | return 0; |
855 | } | 855 | } |
856 | 856 | ||
857 | mutex_lock(lock); | ||
858 | ref_count = fimc ? fimc->vid_cap.refcnt : fimc_lite->ref_count; | ||
859 | |||
857 | if (!(flags & MEDIA_LNK_FL_ENABLED)) { | 860 | if (!(flags & MEDIA_LNK_FL_ENABLED)) { |
858 | int i; | 861 | if (ref_count > 0) { |
859 | mutex_lock(lock); | 862 | ret = __fimc_pipeline_close(pipeline); |
860 | ret = __fimc_pipeline_close(pipeline); | 863 | if (!ret && fimc) |
864 | fimc_ctrls_delete(fimc->vid_cap.ctx); | ||
865 | } | ||
861 | for (i = 0; i < IDX_MAX; i++) | 866 | for (i = 0; i < IDX_MAX; i++) |
862 | pipeline->subdevs[i] = NULL; | 867 | pipeline->subdevs[i] = NULL; |
863 | if (fimc) | 868 | } else if (ref_count > 0) { |
864 | fimc_ctrls_delete(fimc->vid_cap.ctx); | 869 | /* |
865 | mutex_unlock(lock); | 870 | * Link activation. Enable power of pipeline elements only if |
866 | return ret; | 871 | * the pipeline is already in use, i.e. its video node is open. |
872 | * Recreate the controls destroyed during the link deactivation. | ||
873 | */ | ||
874 | ret = __fimc_pipeline_open(pipeline, | ||
875 | source->entity, true); | ||
876 | if (!ret && fimc) | ||
877 | ret = fimc_capture_ctrls_create(fimc); | ||
867 | } | 878 | } |
868 | /* | ||
869 | * Link activation. Enable power of pipeline elements only if the | ||
870 | * pipeline is already in use, i.e. its video node is opened. | ||
871 | * Recreate the controls destroyed during the link deactivation. | ||
872 | */ | ||
873 | mutex_lock(lock); | ||
874 | |||
875 | ref_count = fimc ? fimc->vid_cap.refcnt : fimc_lite->ref_count; | ||
876 | if (ref_count > 0) | ||
877 | ret = __fimc_pipeline_open(pipeline, source->entity, true); | ||
878 | if (!ret && fimc) | ||
879 | ret = fimc_capture_ctrls_create(fimc); | ||
880 | 879 | ||
881 | mutex_unlock(lock); | 880 | mutex_unlock(lock); |
882 | return ret ? -EPIPE : ret; | 881 | return ret ? -EPIPE : ret; |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index e84703c314ce..1cb6d57987c6 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | |||
@@ -276,7 +276,7 @@ static void s5p_mfc_handle_frame_new(struct s5p_mfc_ctx *ctx, unsigned int err) | |||
276 | unsigned int frame_type; | 276 | unsigned int frame_type; |
277 | 277 | ||
278 | dspl_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dspl_y_adr, dev); | 278 | dspl_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dspl_y_adr, dev); |
279 | frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_dec_frame_type, dev); | 279 | frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_disp_frame_type, ctx); |
280 | 280 | ||
281 | /* If frame is same as previous then skip and do not dequeue */ | 281 | /* If frame is same as previous then skip and do not dequeue */ |
282 | if (frame_type == S5P_FIMV_DECODE_FRAME_SKIPPED) { | 282 | if (frame_type == S5P_FIMV_DECODE_FRAME_SKIPPED) { |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2356fd52a169..4f6b553c4b2d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -232,6 +232,7 @@ static struct mfc_control controls[] = { | |||
232 | .minimum = 0, | 232 | .minimum = 0, |
233 | .maximum = 1, | 233 | .maximum = 1, |
234 | .default_value = 0, | 234 | .default_value = 0, |
235 | .step = 1, | ||
235 | .menu_skip_mask = 0, | 236 | .menu_skip_mask = 0, |
236 | }, | 237 | }, |
237 | { | 238 | { |
diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c index c61f590029ad..348dafc0318a 100644 --- a/drivers/media/radio/radio-ma901.c +++ b/drivers/media/radio/radio-ma901.c | |||
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev) | |||
347 | static int usb_ma901radio_probe(struct usb_interface *intf, | 347 | static int usb_ma901radio_probe(struct usb_interface *intf, |
348 | const struct usb_device_id *id) | 348 | const struct usb_device_id *id) |
349 | { | 349 | { |
350 | struct usb_device *dev = interface_to_usbdev(intf); | ||
350 | struct ma901radio_device *radio; | 351 | struct ma901radio_device *radio; |
351 | int retval = 0; | 352 | int retval = 0; |
352 | 353 | ||
354 | /* Masterkit MA901 usb radio has the same USB ID as many others | ||
355 | * Atmel V-USB devices. Let's make additional checks to be sure | ||
356 | * that this is our device. | ||
357 | */ | ||
358 | |||
359 | if (dev->product && dev->manufacturer && | ||
360 | (strncmp(dev->product, "MA901", 5) != 0 | ||
361 | || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0)) | ||
362 | return -ENODEV; | ||
363 | |||
353 | radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); | 364 | radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); |
354 | if (!radio) { | 365 | if (!radio) { |
355 | dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); | 366 | dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); |
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig index 19f3563c61da..5a79c333d45e 100644 --- a/drivers/media/rc/Kconfig +++ b/drivers/media/rc/Kconfig | |||
@@ -291,7 +291,7 @@ config IR_TTUSBIR | |||
291 | 291 | ||
292 | config IR_RX51 | 292 | config IR_RX51 |
293 | tristate "Nokia N900 IR transmitter diode" | 293 | tristate "Nokia N900 IR transmitter diode" |
294 | depends on OMAP_DM_TIMER && LIRC && !ARCH_MULTIPLATFORM | 294 | depends on OMAP_DM_TIMER && ARCH_OMAP2PLUS && LIRC && !ARCH_MULTIPLATFORM |
295 | ---help--- | 295 | ---help--- |
296 | Say Y or M here if you want to enable support for the IR | 296 | Say Y or M here if you want to enable support for the IR |
297 | transmitter diode built in the Nokia N900 (RX51) device. | 297 | transmitter diode built in the Nokia N900 (RX51) device. |
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index a9d355230e8e..768aaf62d5dc 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile | |||
@@ -10,7 +10,7 @@ ifeq ($(CONFIG_COMPAT),y) | |||
10 | videodev-objs += v4l2-compat-ioctl32.o | 10 | videodev-objs += v4l2-compat-ioctl32.o |
11 | endif | 11 | endif |
12 | 12 | ||
13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o | 13 | obj-$(CONFIG_VIDEO_V4L2) += videodev.o |
14 | obj-$(CONFIG_VIDEO_V4L2_INT_DEVICE) += v4l2-int-device.o | 14 | obj-$(CONFIG_VIDEO_V4L2_INT_DEVICE) += v4l2-int-device.o |
15 | obj-$(CONFIG_VIDEO_V4L2) += v4l2-common.o | 15 | obj-$(CONFIG_VIDEO_V4L2) += v4l2-common.o |
16 | 16 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 671f5b171c73..c346941a2515 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -858,6 +858,7 @@ config EZX_PCAP | |||
858 | config AB8500_CORE | 858 | config AB8500_CORE |
859 | bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" | 859 | bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" |
860 | depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU | 860 | depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU |
861 | select POWER_SUPPLY | ||
861 | select MFD_CORE | 862 | select MFD_CORE |
862 | select IRQ_DOMAIN | 863 | select IRQ_DOMAIN |
863 | help | 864 | help |
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index b1f3561b023f..5f341a50ee5a 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c | |||
@@ -594,9 +594,12 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev) | |||
594 | static int ab8500_gpadc_runtime_resume(struct device *dev) | 594 | static int ab8500_gpadc_runtime_resume(struct device *dev) |
595 | { | 595 | { |
596 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); | 596 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); |
597 | int ret; | ||
597 | 598 | ||
598 | regulator_enable(gpadc->regu); | 599 | ret = regulator_enable(gpadc->regu); |
599 | return 0; | 600 | if (ret) |
601 | dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret); | ||
602 | return ret; | ||
600 | } | 603 | } |
601 | 604 | ||
602 | static int ab8500_gpadc_runtime_idle(struct device *dev) | 605 | static int ab8500_gpadc_runtime_idle(struct device *dev) |
@@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
643 | } | 646 | } |
644 | 647 | ||
645 | /* VTVout LDO used to power up ab8500-GPADC */ | 648 | /* VTVout LDO used to power up ab8500-GPADC */ |
646 | gpadc->regu = regulator_get(&pdev->dev, "vddadc"); | 649 | gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc"); |
647 | if (IS_ERR(gpadc->regu)) { | 650 | if (IS_ERR(gpadc->regu)) { |
648 | ret = PTR_ERR(gpadc->regu); | 651 | ret = PTR_ERR(gpadc->regu); |
649 | dev_err(gpadc->dev, "failed to get vtvout LDO\n"); | 652 | dev_err(gpadc->dev, "failed to get vtvout LDO\n"); |
@@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
652 | 655 | ||
653 | platform_set_drvdata(pdev, gpadc); | 656 | platform_set_drvdata(pdev, gpadc); |
654 | 657 | ||
655 | regulator_enable(gpadc->regu); | 658 | ret = regulator_enable(gpadc->regu); |
659 | if (ret) { | ||
660 | dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret); | ||
661 | goto fail_enable; | ||
662 | } | ||
656 | 663 | ||
657 | pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); | 664 | pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); |
658 | pm_runtime_use_autosuspend(gpadc->dev); | 665 | pm_runtime_use_autosuspend(gpadc->dev); |
@@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
663 | list_add_tail(&gpadc->node, &ab8500_gpadc_list); | 670 | list_add_tail(&gpadc->node, &ab8500_gpadc_list); |
664 | dev_dbg(gpadc->dev, "probe success\n"); | 671 | dev_dbg(gpadc->dev, "probe success\n"); |
665 | return 0; | 672 | return 0; |
673 | |||
674 | fail_enable: | ||
666 | fail_irq: | 675 | fail_irq: |
667 | free_irq(gpadc->irq, gpadc); | 676 | free_irq(gpadc->irq, gpadc); |
668 | fail: | 677 | fail: |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 6b5edf64de2b..4febc5c7fdee 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -460,15 +460,15 @@ static void omap_usbhs_init(struct device *dev) | |||
460 | 460 | ||
461 | switch (omap->usbhs_rev) { | 461 | switch (omap->usbhs_rev) { |
462 | case OMAP_USBHS_REV1: | 462 | case OMAP_USBHS_REV1: |
463 | omap_usbhs_rev1_hostconfig(omap, reg); | 463 | reg = omap_usbhs_rev1_hostconfig(omap, reg); |
464 | break; | 464 | break; |
465 | 465 | ||
466 | case OMAP_USBHS_REV2: | 466 | case OMAP_USBHS_REV2: |
467 | omap_usbhs_rev2_hostconfig(omap, reg); | 467 | reg = omap_usbhs_rev2_hostconfig(omap, reg); |
468 | break; | 468 | break; |
469 | 469 | ||
470 | default: /* newer revisions */ | 470 | default: /* newer revisions */ |
471 | omap_usbhs_rev2_hostconfig(omap, reg); | 471 | reg = omap_usbhs_rev2_hostconfig(omap, reg); |
472 | break; | 472 | break; |
473 | } | 473 | } |
474 | 474 | ||
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index bbdbc50a3cca..73bf76df1044 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -257,9 +257,24 @@ static struct regmap_irq_chip palmas_irq_chip = { | |||
257 | PALMAS_INT1_MASK), | 257 | PALMAS_INT1_MASK), |
258 | }; | 258 | }; |
259 | 259 | ||
260 | static void palmas_dt_to_pdata(struct device_node *node, | 260 | static int palmas_set_pdata_irq_flag(struct i2c_client *i2c, |
261 | struct palmas_platform_data *pdata) | 261 | struct palmas_platform_data *pdata) |
262 | { | 262 | { |
263 | struct irq_data *irq_data = irq_get_irq_data(i2c->irq); | ||
264 | if (!irq_data) { | ||
265 | dev_err(&i2c->dev, "Invalid IRQ: %d\n", i2c->irq); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | pdata->irq_flags = irqd_get_trigger_type(irq_data); | ||
270 | dev_info(&i2c->dev, "Irq flag is 0x%08x\n", pdata->irq_flags); | ||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static void palmas_dt_to_pdata(struct i2c_client *i2c, | ||
275 | struct palmas_platform_data *pdata) | ||
276 | { | ||
277 | struct device_node *node = i2c->dev.of_node; | ||
263 | int ret; | 278 | int ret; |
264 | u32 prop; | 279 | u32 prop; |
265 | 280 | ||
@@ -283,6 +298,8 @@ static void palmas_dt_to_pdata(struct device_node *node, | |||
283 | pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK | | 298 | pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK | |
284 | PALMAS_POWER_CTRL_ENABLE1_MASK | | 299 | PALMAS_POWER_CTRL_ENABLE1_MASK | |
285 | PALMAS_POWER_CTRL_ENABLE2_MASK; | 300 | PALMAS_POWER_CTRL_ENABLE2_MASK; |
301 | if (i2c->irq) | ||
302 | palmas_set_pdata_irq_flag(i2c, pdata); | ||
286 | } | 303 | } |
287 | 304 | ||
288 | static int palmas_i2c_probe(struct i2c_client *i2c, | 305 | static int palmas_i2c_probe(struct i2c_client *i2c, |
@@ -304,7 +321,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
304 | if (!pdata) | 321 | if (!pdata) |
305 | return -ENOMEM; | 322 | return -ENOMEM; |
306 | 323 | ||
307 | palmas_dt_to_pdata(node, pdata); | 324 | palmas_dt_to_pdata(i2c, pdata); |
308 | } | 325 | } |
309 | 326 | ||
310 | if (!pdata) | 327 | if (!pdata) |
@@ -344,6 +361,19 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
344 | } | 361 | } |
345 | } | 362 | } |
346 | 363 | ||
364 | /* Change interrupt line output polarity */ | ||
365 | if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH) | ||
366 | reg = PALMAS_POLARITY_CTRL_INT_POLARITY; | ||
367 | else | ||
368 | reg = 0; | ||
369 | ret = palmas_update_bits(palmas, PALMAS_PU_PD_OD_BASE, | ||
370 | PALMAS_POLARITY_CTRL, PALMAS_POLARITY_CTRL_INT_POLARITY, | ||
371 | reg); | ||
372 | if (ret < 0) { | ||
373 | dev_err(palmas->dev, "POLARITY_CTRL updat failed: %d\n", ret); | ||
374 | goto err; | ||
375 | } | ||
376 | |||
347 | /* Change IRQ into clear on read mode for efficiency */ | 377 | /* Change IRQ into clear on read mode for efficiency */ |
348 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); | 378 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); |
349 | addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); | 379 | addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); |
@@ -352,7 +382,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
352 | regmap_write(palmas->regmap[slave], addr, reg); | 382 | regmap_write(palmas->regmap[slave], addr, reg); |
353 | 383 | ||
354 | ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, | 384 | ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, |
355 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, 0, &palmas_irq_chip, | 385 | IRQF_ONESHOT | pdata->irq_flags, 0, &palmas_irq_chip, |
356 | &palmas->irq_data); | 386 | &palmas->irq_data); |
357 | if (ret < 0) | 387 | if (ret < 0) |
358 | goto err; | 388 | goto err; |
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c index 4658b5bdcd84..aeb8e40ab424 100644 --- a/drivers/mfd/tps65912-core.c +++ b/drivers/mfd/tps65912-core.c | |||
@@ -169,6 +169,7 @@ err: | |||
169 | void tps65912_device_exit(struct tps65912 *tps65912) | 169 | void tps65912_device_exit(struct tps65912 *tps65912) |
170 | { | 170 | { |
171 | mfd_remove_devices(tps65912->dev); | 171 | mfd_remove_devices(tps65912->dev); |
172 | tps65912_irq_exit(tps65912); | ||
172 | kfree(tps65912); | 173 | kfree(tps65912); |
173 | } | 174 | } |
174 | 175 | ||
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index e16edca92670..d2ab222138c2 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c | |||
@@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(twl4030_audio_enable_resource); | |||
118 | * Disable the resource. | 118 | * Disable the resource. |
119 | * The function returns with error or the content of the register | 119 | * The function returns with error or the content of the register |
120 | */ | 120 | */ |
121 | int twl4030_audio_disable_resource(unsigned id) | 121 | int twl4030_audio_disable_resource(enum twl4030_audio_res id) |
122 | { | 122 | { |
123 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); | 123 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
124 | int val; | 124 | int val; |
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c index 88ff9dc83305..942b666a2a07 100644 --- a/drivers/mfd/twl4030-madc.c +++ b/drivers/mfd/twl4030-madc.c | |||
@@ -800,7 +800,7 @@ static int twl4030_madc_remove(struct platform_device *pdev) | |||
800 | 800 | ||
801 | static struct platform_driver twl4030_madc_driver = { | 801 | static struct platform_driver twl4030_madc_driver = { |
802 | .probe = twl4030_madc_probe, | 802 | .probe = twl4030_madc_probe, |
803 | .remove = __exit_p(twl4030_madc_remove), | 803 | .remove = twl4030_madc_remove, |
804 | .driver = { | 804 | .driver = { |
805 | .name = "twl4030_madc", | 805 | .name = "twl4030_madc", |
806 | .owner = THIS_MODULE, | 806 | .owner = THIS_MODULE, |
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index 45ea7185c003..642c6223fa6c 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
@@ -152,6 +152,20 @@ static void mei_me_intr_disable(struct mei_device *dev) | |||
152 | } | 152 | } |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * mei_me_hw_reset_release - release device from the reset | ||
156 | * | ||
157 | * @dev: the device structure | ||
158 | */ | ||
159 | static void mei_me_hw_reset_release(struct mei_device *dev) | ||
160 | { | ||
161 | struct mei_me_hw *hw = to_me_hw(dev); | ||
162 | u32 hcsr = mei_hcsr_read(hw); | ||
163 | |||
164 | hcsr |= H_IG; | ||
165 | hcsr &= ~H_RST; | ||
166 | mei_hcsr_set(hw, hcsr); | ||
167 | } | ||
168 | /** | ||
155 | * mei_me_hw_reset - resets fw via mei csr register. | 169 | * mei_me_hw_reset - resets fw via mei csr register. |
156 | * | 170 | * |
157 | * @dev: the device structure | 171 | * @dev: the device structure |
@@ -169,18 +183,14 @@ static void mei_me_hw_reset(struct mei_device *dev, bool intr_enable) | |||
169 | if (intr_enable) | 183 | if (intr_enable) |
170 | hcsr |= H_IE; | 184 | hcsr |= H_IE; |
171 | else | 185 | else |
172 | hcsr &= ~H_IE; | 186 | hcsr |= ~H_IE; |
173 | |||
174 | mei_hcsr_set(hw, hcsr); | ||
175 | |||
176 | hcsr = mei_hcsr_read(hw) | H_IG; | ||
177 | hcsr &= ~H_RST; | ||
178 | 187 | ||
179 | mei_hcsr_set(hw, hcsr); | 188 | mei_hcsr_set(hw, hcsr); |
180 | 189 | ||
181 | hcsr = mei_hcsr_read(hw); | 190 | if (dev->dev_state == MEI_DEV_POWER_DOWN) |
191 | mei_me_hw_reset_release(dev); | ||
182 | 192 | ||
183 | dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", hcsr); | 193 | dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", mei_hcsr_read(hw)); |
184 | } | 194 | } |
185 | 195 | ||
186 | /** | 196 | /** |
@@ -466,7 +476,8 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) | |||
466 | mutex_unlock(&dev->device_lock); | 476 | mutex_unlock(&dev->device_lock); |
467 | return IRQ_HANDLED; | 477 | return IRQ_HANDLED; |
468 | } else { | 478 | } else { |
469 | dev_dbg(&dev->pdev->dev, "FW not ready.\n"); | 479 | dev_dbg(&dev->pdev->dev, "Reset Completed.\n"); |
480 | mei_me_hw_reset_release(dev); | ||
470 | mutex_unlock(&dev->device_lock); | 481 | mutex_unlock(&dev->device_lock); |
471 | return IRQ_HANDLED; | 482 | return IRQ_HANDLED; |
472 | } | 483 | } |
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 6ec530168afb..356179991a2e 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -183,6 +183,24 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
183 | mei_cl_all_write_clear(dev); | 183 | mei_cl_all_write_clear(dev); |
184 | } | 184 | } |
185 | 185 | ||
186 | void mei_stop(struct mei_device *dev) | ||
187 | { | ||
188 | dev_dbg(&dev->pdev->dev, "stopping the device.\n"); | ||
189 | |||
190 | mutex_lock(&dev->device_lock); | ||
191 | |||
192 | cancel_delayed_work(&dev->timer_work); | ||
193 | |||
194 | mei_wd_stop(dev); | ||
195 | |||
196 | dev->dev_state = MEI_DEV_POWER_DOWN; | ||
197 | mei_reset(dev, 0); | ||
198 | |||
199 | mutex_unlock(&dev->device_lock); | ||
200 | |||
201 | flush_scheduled_work(); | ||
202 | } | ||
203 | |||
186 | 204 | ||
187 | 205 | ||
188 | 206 | ||
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index cb80166161f0..97873812e33b 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -381,6 +381,7 @@ static inline unsigned long mei_secs_to_jiffies(unsigned long sec) | |||
381 | void mei_device_init(struct mei_device *dev); | 381 | void mei_device_init(struct mei_device *dev); |
382 | void mei_reset(struct mei_device *dev, int interrupts); | 382 | void mei_reset(struct mei_device *dev, int interrupts); |
383 | int mei_hw_init(struct mei_device *dev); | 383 | int mei_hw_init(struct mei_device *dev); |
384 | void mei_stop(struct mei_device *dev); | ||
384 | 385 | ||
385 | /* | 386 | /* |
386 | * MEI interrupt functions prototype | 387 | * MEI interrupt functions prototype |
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index b40ec0601ab0..b8b5c9c3ad03 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
@@ -247,44 +247,14 @@ static void mei_remove(struct pci_dev *pdev) | |||
247 | 247 | ||
248 | hw = to_me_hw(dev); | 248 | hw = to_me_hw(dev); |
249 | 249 | ||
250 | mutex_lock(&dev->device_lock); | ||
251 | |||
252 | cancel_delayed_work(&dev->timer_work); | ||
253 | 250 | ||
254 | mei_wd_stop(dev); | 251 | dev_err(&pdev->dev, "stop\n"); |
252 | mei_stop(dev); | ||
255 | 253 | ||
256 | mei_pdev = NULL; | 254 | mei_pdev = NULL; |
257 | 255 | ||
258 | if (dev->iamthif_cl.state == MEI_FILE_CONNECTED) { | ||
259 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTING; | ||
260 | mei_cl_disconnect(&dev->iamthif_cl); | ||
261 | } | ||
262 | if (dev->wd_cl.state == MEI_FILE_CONNECTED) { | ||
263 | dev->wd_cl.state = MEI_FILE_DISCONNECTING; | ||
264 | mei_cl_disconnect(&dev->wd_cl); | ||
265 | } | ||
266 | |||
267 | /* Unregistering watchdog device */ | ||
268 | mei_watchdog_unregister(dev); | 256 | mei_watchdog_unregister(dev); |
269 | 257 | ||
270 | /* remove entry if already in list */ | ||
271 | dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); | ||
272 | |||
273 | if (dev->open_handle_count > 0) | ||
274 | dev->open_handle_count--; | ||
275 | mei_cl_unlink(&dev->wd_cl); | ||
276 | |||
277 | if (dev->open_handle_count > 0) | ||
278 | dev->open_handle_count--; | ||
279 | mei_cl_unlink(&dev->iamthif_cl); | ||
280 | |||
281 | dev->iamthif_current_cb = NULL; | ||
282 | dev->me_clients_num = 0; | ||
283 | |||
284 | mutex_unlock(&dev->device_lock); | ||
285 | |||
286 | flush_scheduled_work(); | ||
287 | |||
288 | /* disable interrupts */ | 258 | /* disable interrupts */ |
289 | mei_disable_interrupts(dev); | 259 | mei_disable_interrupts(dev); |
290 | 260 | ||
@@ -308,28 +278,20 @@ static int mei_pci_suspend(struct device *device) | |||
308 | { | 278 | { |
309 | struct pci_dev *pdev = to_pci_dev(device); | 279 | struct pci_dev *pdev = to_pci_dev(device); |
310 | struct mei_device *dev = pci_get_drvdata(pdev); | 280 | struct mei_device *dev = pci_get_drvdata(pdev); |
311 | int err; | ||
312 | 281 | ||
313 | if (!dev) | 282 | if (!dev) |
314 | return -ENODEV; | 283 | return -ENODEV; |
315 | mutex_lock(&dev->device_lock); | ||
316 | 284 | ||
317 | cancel_delayed_work(&dev->timer_work); | 285 | dev_err(&pdev->dev, "suspend\n"); |
318 | 286 | ||
319 | /* Stop watchdog if exists */ | 287 | mei_stop(dev); |
320 | err = mei_wd_stop(dev); | 288 | |
321 | /* Set new mei state */ | 289 | mei_disable_interrupts(dev); |
322 | if (dev->dev_state == MEI_DEV_ENABLED || | ||
323 | dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) { | ||
324 | dev->dev_state = MEI_DEV_POWER_DOWN; | ||
325 | mei_reset(dev, 0); | ||
326 | } | ||
327 | mutex_unlock(&dev->device_lock); | ||
328 | 290 | ||
329 | free_irq(pdev->irq, dev); | 291 | free_irq(pdev->irq, dev); |
330 | pci_disable_msi(pdev); | 292 | pci_disable_msi(pdev); |
331 | 293 | ||
332 | return err; | 294 | return 0; |
333 | } | 295 | } |
334 | 296 | ||
335 | static int mei_pci_resume(struct device *device) | 297 | static int mei_pci_resume(struct device *device) |
diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig index 39c2ecadb273..ea98f7e9ccd1 100644 --- a/drivers/misc/vmw_vmci/Kconfig +++ b/drivers/misc/vmw_vmci/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config VMWARE_VMCI | 5 | config VMWARE_VMCI |
6 | tristate "VMware VMCI Driver" | 6 | tristate "VMware VMCI Driver" |
7 | depends on X86 && PCI | 7 | depends on X86 && PCI && NET |
8 | help | 8 | help |
9 | This is VMware's Virtual Machine Communication Interface. It enables | 9 | This is VMware's Virtual Machine Communication Interface. It enables |
10 | high-speed communication between host and guest in a virtual | 10 | high-speed communication between host and guest in a virtual |
diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c index ed5c433cd493..f3cdd904fe4d 100644 --- a/drivers/misc/vmw_vmci/vmci_datagram.c +++ b/drivers/misc/vmw_vmci/vmci_datagram.c | |||
@@ -42,9 +42,11 @@ struct datagram_entry { | |||
42 | 42 | ||
43 | struct delayed_datagram_info { | 43 | struct delayed_datagram_info { |
44 | struct datagram_entry *entry; | 44 | struct datagram_entry *entry; |
45 | struct vmci_datagram msg; | ||
46 | struct work_struct work; | 45 | struct work_struct work; |
47 | bool in_dg_host_queue; | 46 | bool in_dg_host_queue; |
47 | /* msg and msg_payload must be together. */ | ||
48 | struct vmci_datagram msg; | ||
49 | u8 msg_payload[]; | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | /* Number of in-flight host->host datagrams */ | 52 | /* Number of in-flight host->host datagrams */ |
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index 63feb75cc8e0..9279a9174f84 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c | |||
@@ -19,6 +19,12 @@ | |||
19 | /* 10 parts were found on sflash on Netgear WNDR4500 */ | 19 | /* 10 parts were found on sflash on Netgear WNDR4500 */ |
20 | #define BCM47XXPART_MAX_PARTS 12 | 20 | #define BCM47XXPART_MAX_PARTS 12 |
21 | 21 | ||
22 | /* | ||
23 | * Amount of bytes we read when analyzing each block of flash memory. | ||
24 | * Set it big enough to allow detecting partition and reading important data. | ||
25 | */ | ||
26 | #define BCM47XXPART_BYTES_TO_READ 0x404 | ||
27 | |||
22 | /* Magics */ | 28 | /* Magics */ |
23 | #define BOARD_DATA_MAGIC 0x5246504D /* MPFR */ | 29 | #define BOARD_DATA_MAGIC 0x5246504D /* MPFR */ |
24 | #define POT_MAGIC1 0x54544f50 /* POTT */ | 30 | #define POT_MAGIC1 0x54544f50 /* POTT */ |
@@ -57,17 +63,15 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
57 | struct trx_header *trx; | 63 | struct trx_header *trx; |
58 | int trx_part = -1; | 64 | int trx_part = -1; |
59 | int last_trx_part = -1; | 65 | int last_trx_part = -1; |
60 | int max_bytes_to_read = 0x8004; | 66 | int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; |
61 | 67 | ||
62 | if (blocksize <= 0x10000) | 68 | if (blocksize <= 0x10000) |
63 | blocksize = 0x10000; | 69 | blocksize = 0x10000; |
64 | if (blocksize == 0x20000) | ||
65 | max_bytes_to_read = 0x18004; | ||
66 | 70 | ||
67 | /* Alloc */ | 71 | /* Alloc */ |
68 | parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, | 72 | parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, |
69 | GFP_KERNEL); | 73 | GFP_KERNEL); |
70 | buf = kzalloc(max_bytes_to_read, GFP_KERNEL); | 74 | buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL); |
71 | 75 | ||
72 | /* Parse block by block looking for magics */ | 76 | /* Parse block by block looking for magics */ |
73 | for (offset = 0; offset <= master->size - blocksize; | 77 | for (offset = 0; offset <= master->size - blocksize; |
@@ -82,7 +86,7 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
82 | } | 86 | } |
83 | 87 | ||
84 | /* Read beginning of the block */ | 88 | /* Read beginning of the block */ |
85 | if (mtd_read(master, offset, max_bytes_to_read, | 89 | if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, |
86 | &bytes_read, (uint8_t *)buf) < 0) { | 90 | &bytes_read, (uint8_t *)buf) < 0) { |
87 | pr_err("mtd_read error while parsing (offset: 0x%X)!\n", | 91 | pr_err("mtd_read error while parsing (offset: 0x%X)!\n", |
88 | offset); | 92 | offset); |
@@ -96,20 +100,6 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
96 | continue; | 100 | continue; |
97 | } | 101 | } |
98 | 102 | ||
99 | /* Standard NVRAM */ | ||
100 | if (buf[0x000 / 4] == NVRAM_HEADER || | ||
101 | buf[0x1000 / 4] == NVRAM_HEADER || | ||
102 | buf[0x8000 / 4] == NVRAM_HEADER || | ||
103 | (blocksize == 0x20000 && ( | ||
104 | buf[0x10000 / 4] == NVRAM_HEADER || | ||
105 | buf[0x11000 / 4] == NVRAM_HEADER || | ||
106 | buf[0x18000 / 4] == NVRAM_HEADER))) { | ||
107 | bcm47xxpart_add_part(&parts[curr_part++], "nvram", | ||
108 | offset, 0); | ||
109 | offset = rounddown(offset, blocksize); | ||
110 | continue; | ||
111 | } | ||
112 | |||
113 | /* | 103 | /* |
114 | * board_data starts with board_id which differs across boards, | 104 | * board_data starts with board_id which differs across boards, |
115 | * but we can use 'MPFR' (hopefully) magic at 0x100 | 105 | * but we can use 'MPFR' (hopefully) magic at 0x100 |
@@ -178,6 +168,30 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
178 | continue; | 168 | continue; |
179 | } | 169 | } |
180 | } | 170 | } |
171 | |||
172 | /* Look for NVRAM at the end of the last block. */ | ||
173 | for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) { | ||
174 | if (curr_part > BCM47XXPART_MAX_PARTS) { | ||
175 | pr_warn("Reached maximum number of partitions, scanning stopped!\n"); | ||
176 | break; | ||
177 | } | ||
178 | |||
179 | offset = master->size - possible_nvram_sizes[i]; | ||
180 | if (mtd_read(master, offset, 0x4, &bytes_read, | ||
181 | (uint8_t *)buf) < 0) { | ||
182 | pr_err("mtd_read error while reading at offset 0x%X!\n", | ||
183 | offset); | ||
184 | continue; | ||
185 | } | ||
186 | |||
187 | /* Standard NVRAM */ | ||
188 | if (buf[0] == NVRAM_HEADER) { | ||
189 | bcm47xxpart_add_part(&parts[curr_part++], "nvram", | ||
190 | master->size - blocksize, 0); | ||
191 | break; | ||
192 | } | ||
193 | } | ||
194 | |||
181 | kfree(buf); | 195 | kfree(buf); |
182 | 196 | ||
183 | /* | 197 | /* |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 92ab30ab00dc..dc571ebc1aa0 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -1123,33 +1123,6 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, | |||
1123 | } | 1123 | } |
1124 | #endif | 1124 | #endif |
1125 | 1125 | ||
1126 | static inline unsigned long get_vm_size(struct vm_area_struct *vma) | ||
1127 | { | ||
1128 | return vma->vm_end - vma->vm_start; | ||
1129 | } | ||
1130 | |||
1131 | static inline resource_size_t get_vm_offset(struct vm_area_struct *vma) | ||
1132 | { | ||
1133 | return (resource_size_t) vma->vm_pgoff << PAGE_SHIFT; | ||
1134 | } | ||
1135 | |||
1136 | /* | ||
1137 | * Set a new vm offset. | ||
1138 | * | ||
1139 | * Verify that the incoming offset really works as a page offset, | ||
1140 | * and that the offset and size fit in a resource_size_t. | ||
1141 | */ | ||
1142 | static inline int set_vm_offset(struct vm_area_struct *vma, resource_size_t off) | ||
1143 | { | ||
1144 | pgoff_t pgoff = off >> PAGE_SHIFT; | ||
1145 | if (off != (resource_size_t) pgoff << PAGE_SHIFT) | ||
1146 | return -EINVAL; | ||
1147 | if (off + get_vm_size(vma) - 1 < off) | ||
1148 | return -EINVAL; | ||
1149 | vma->vm_pgoff = pgoff; | ||
1150 | return 0; | ||
1151 | } | ||
1152 | |||
1153 | /* | 1126 | /* |
1154 | * set up a mapping for shared memory segments | 1127 | * set up a mapping for shared memory segments |
1155 | */ | 1128 | */ |
@@ -1159,45 +1132,17 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) | |||
1159 | struct mtd_file_info *mfi = file->private_data; | 1132 | struct mtd_file_info *mfi = file->private_data; |
1160 | struct mtd_info *mtd = mfi->mtd; | 1133 | struct mtd_info *mtd = mfi->mtd; |
1161 | struct map_info *map = mtd->priv; | 1134 | struct map_info *map = mtd->priv; |
1162 | resource_size_t start, off; | ||
1163 | unsigned long len, vma_len; | ||
1164 | 1135 | ||
1165 | /* This is broken because it assumes the MTD device is map-based | 1136 | /* This is broken because it assumes the MTD device is map-based |
1166 | and that mtd->priv is a valid struct map_info. It should be | 1137 | and that mtd->priv is a valid struct map_info. It should be |
1167 | replaced with something that uses the mtd_get_unmapped_area() | 1138 | replaced with something that uses the mtd_get_unmapped_area() |
1168 | operation properly. */ | 1139 | operation properly. */ |
1169 | if (0 /*mtd->type == MTD_RAM || mtd->type == MTD_ROM*/) { | 1140 | if (0 /*mtd->type == MTD_RAM || mtd->type == MTD_ROM*/) { |
1170 | off = get_vm_offset(vma); | ||
1171 | start = map->phys; | ||
1172 | len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size); | ||
1173 | start &= PAGE_MASK; | ||
1174 | vma_len = get_vm_size(vma); | ||
1175 | |||
1176 | /* Overflow in off+len? */ | ||
1177 | if (vma_len + off < off) | ||
1178 | return -EINVAL; | ||
1179 | /* Does it fit in the mapping? */ | ||
1180 | if (vma_len + off > len) | ||
1181 | return -EINVAL; | ||
1182 | |||
1183 | off += start; | ||
1184 | /* Did that overflow? */ | ||
1185 | if (off < start) | ||
1186 | return -EINVAL; | ||
1187 | if (set_vm_offset(vma, off) < 0) | ||
1188 | return -EINVAL; | ||
1189 | vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; | ||
1190 | |||
1191 | #ifdef pgprot_noncached | 1141 | #ifdef pgprot_noncached |
1192 | if (file->f_flags & O_DSYNC || off >= __pa(high_memory)) | 1142 | if (file->f_flags & O_DSYNC || map->phys >= __pa(high_memory)) |
1193 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 1143 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
1194 | #endif | 1144 | #endif |
1195 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 1145 | return vm_iomap_memory(vma, map->phys, map->size); |
1196 | vma->vm_end - vma->vm_start, | ||
1197 | vma->vm_page_prot)) | ||
1198 | return -EAGAIN; | ||
1199 | |||
1200 | return 0; | ||
1201 | } | 1146 | } |
1202 | return -ENOSYS; | 1147 | return -ENOSYS; |
1203 | #else | 1148 | #else |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 43214151b882..42c63927609d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1523,6 +1523,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, | |||
1523 | oobreadlen -= toread; | 1523 | oobreadlen -= toread; |
1524 | } | 1524 | } |
1525 | } | 1525 | } |
1526 | |||
1527 | if (chip->options & NAND_NEED_READRDY) { | ||
1528 | /* Apply delay or wait for ready/busy pin */ | ||
1529 | if (!chip->dev_ready) | ||
1530 | udelay(chip->chip_delay); | ||
1531 | else | ||
1532 | nand_wait_ready(mtd); | ||
1533 | } | ||
1526 | } else { | 1534 | } else { |
1527 | memcpy(buf, chip->buffers->databuf + col, bytes); | 1535 | memcpy(buf, chip->buffers->databuf + col, bytes); |
1528 | buf += bytes; | 1536 | buf += bytes; |
@@ -1787,6 +1795,14 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, | |||
1787 | len = min(len, readlen); | 1795 | len = min(len, readlen); |
1788 | buf = nand_transfer_oob(chip, buf, ops, len); | 1796 | buf = nand_transfer_oob(chip, buf, ops, len); |
1789 | 1797 | ||
1798 | if (chip->options & NAND_NEED_READRDY) { | ||
1799 | /* Apply delay or wait for ready/busy pin */ | ||
1800 | if (!chip->dev_ready) | ||
1801 | udelay(chip->chip_delay); | ||
1802 | else | ||
1803 | nand_wait_ready(mtd); | ||
1804 | } | ||
1805 | |||
1790 | readlen -= len; | 1806 | readlen -= len; |
1791 | if (!readlen) | 1807 | if (!readlen) |
1792 | break; | 1808 | break; |
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c index e3aa2748a6e7..9c612388e5de 100644 --- a/drivers/mtd/nand/nand_ids.c +++ b/drivers/mtd/nand/nand_ids.c | |||
@@ -22,49 +22,51 @@ | |||
22 | * 512 512 Byte page size | 22 | * 512 512 Byte page size |
23 | */ | 23 | */ |
24 | struct nand_flash_dev nand_flash_ids[] = { | 24 | struct nand_flash_dev nand_flash_ids[] = { |
25 | #define SP_OPTIONS NAND_NEED_READRDY | ||
26 | #define SP_OPTIONS16 (SP_OPTIONS | NAND_BUSWIDTH_16) | ||
25 | 27 | ||
26 | #ifdef CONFIG_MTD_NAND_MUSEUM_IDS | 28 | #ifdef CONFIG_MTD_NAND_MUSEUM_IDS |
27 | {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, | 29 | {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, SP_OPTIONS}, |
28 | {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, | 30 | {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, SP_OPTIONS}, |
29 | {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, | 31 | {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, SP_OPTIONS}, |
30 | {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0}, | 32 | {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, SP_OPTIONS}, |
31 | {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, | 33 | {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, SP_OPTIONS}, |
32 | {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0}, | 34 | {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, SP_OPTIONS}, |
33 | {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0}, | 35 | {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, SP_OPTIONS}, |
34 | {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0}, | 36 | {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, SP_OPTIONS}, |
35 | {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, | 37 | {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, SP_OPTIONS}, |
36 | {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, | 38 | {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, SP_OPTIONS}, |
37 | 39 | ||
38 | {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0}, | 40 | {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, SP_OPTIONS}, |
39 | {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, | 41 | {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, SP_OPTIONS}, |
40 | {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, | 42 | {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, SP_OPTIONS16}, |
41 | {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, | 43 | {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, SP_OPTIONS16}, |
42 | #endif | 44 | #endif |
43 | 45 | ||
44 | {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0}, | 46 | {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, SP_OPTIONS}, |
45 | {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0}, | 47 | {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, SP_OPTIONS}, |
46 | {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, NAND_BUSWIDTH_16}, | 48 | {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, SP_OPTIONS16}, |
47 | {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, NAND_BUSWIDTH_16}, | 49 | {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, SP_OPTIONS16}, |
48 | 50 | ||
49 | {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, 0}, | 51 | {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, SP_OPTIONS}, |
50 | {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, 0}, | 52 | {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, SP_OPTIONS}, |
51 | {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, NAND_BUSWIDTH_16}, | 53 | {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, SP_OPTIONS16}, |
52 | {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, NAND_BUSWIDTH_16}, | 54 | {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, SP_OPTIONS16}, |
53 | 55 | ||
54 | {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, 0}, | 56 | {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, SP_OPTIONS}, |
55 | {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, 0}, | 57 | {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, SP_OPTIONS}, |
56 | {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, NAND_BUSWIDTH_16}, | 58 | {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, SP_OPTIONS16}, |
57 | {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16}, | 59 | {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, SP_OPTIONS16}, |
58 | 60 | ||
59 | {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0}, | 61 | {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, SP_OPTIONS}, |
60 | {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0}, | 62 | {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, SP_OPTIONS}, |
61 | {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0}, | 63 | {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, SP_OPTIONS}, |
62 | {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 64 | {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, SP_OPTIONS16}, |
63 | {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 65 | {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, SP_OPTIONS16}, |
64 | {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 66 | {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, SP_OPTIONS16}, |
65 | {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 67 | {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, SP_OPTIONS16}, |
66 | 68 | ||
67 | {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0}, | 69 | {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, SP_OPTIONS}, |
68 | 70 | ||
69 | /* | 71 | /* |
70 | * These are the new chips with large page size. The pagesize and the | 72 | * These are the new chips with large page size. The pagesize and the |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8b4e96e01d6c..dbbea0eec134 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -846,8 +846,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, | |||
846 | if (bond->dev->flags & IFF_ALLMULTI) | 846 | if (bond->dev->flags & IFF_ALLMULTI) |
847 | dev_set_allmulti(old_active->dev, -1); | 847 | dev_set_allmulti(old_active->dev, -1); |
848 | 848 | ||
849 | netif_addr_lock_bh(bond->dev); | ||
849 | netdev_for_each_mc_addr(ha, bond->dev) | 850 | netdev_for_each_mc_addr(ha, bond->dev) |
850 | dev_mc_del(old_active->dev, ha->addr); | 851 | dev_mc_del(old_active->dev, ha->addr); |
852 | netif_addr_unlock_bh(bond->dev); | ||
851 | } | 853 | } |
852 | 854 | ||
853 | if (new_active) { | 855 | if (new_active) { |
@@ -858,8 +860,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, | |||
858 | if (bond->dev->flags & IFF_ALLMULTI) | 860 | if (bond->dev->flags & IFF_ALLMULTI) |
859 | dev_set_allmulti(new_active->dev, 1); | 861 | dev_set_allmulti(new_active->dev, 1); |
860 | 862 | ||
863 | netif_addr_lock_bh(bond->dev); | ||
861 | netdev_for_each_mc_addr(ha, bond->dev) | 864 | netdev_for_each_mc_addr(ha, bond->dev) |
862 | dev_mc_add(new_active->dev, ha->addr); | 865 | dev_mc_add(new_active->dev, ha->addr); |
866 | netif_addr_unlock_bh(bond->dev); | ||
863 | } | 867 | } |
864 | } | 868 | } |
865 | 869 | ||
@@ -1746,6 +1750,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1746 | 1750 | ||
1747 | bond_compute_features(bond); | 1751 | bond_compute_features(bond); |
1748 | 1752 | ||
1753 | bond_update_speed_duplex(new_slave); | ||
1754 | |||
1749 | read_lock(&bond->lock); | 1755 | read_lock(&bond->lock); |
1750 | 1756 | ||
1751 | new_slave->last_arp_rx = jiffies - | 1757 | new_slave->last_arp_rx = jiffies - |
@@ -1798,8 +1804,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1798 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : | 1804 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : |
1799 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); | 1805 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); |
1800 | 1806 | ||
1801 | bond_update_speed_duplex(new_slave); | ||
1802 | |||
1803 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1807 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
1804 | /* if there is a primary slave, remember it */ | 1808 | /* if there is a primary slave, remember it */ |
1805 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { | 1809 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { |
@@ -1901,11 +1905,29 @@ err_dest_symlinks: | |||
1901 | bond_destroy_slave_symlinks(bond_dev, slave_dev); | 1905 | bond_destroy_slave_symlinks(bond_dev, slave_dev); |
1902 | 1906 | ||
1903 | err_detach: | 1907 | err_detach: |
1908 | if (!USES_PRIMARY(bond->params.mode)) { | ||
1909 | netif_addr_lock_bh(bond_dev); | ||
1910 | bond_mc_list_flush(bond_dev, slave_dev); | ||
1911 | netif_addr_unlock_bh(bond_dev); | ||
1912 | } | ||
1913 | bond_del_vlans_from_slave(bond, slave_dev); | ||
1904 | write_lock_bh(&bond->lock); | 1914 | write_lock_bh(&bond->lock); |
1905 | bond_detach_slave(bond, new_slave); | 1915 | bond_detach_slave(bond, new_slave); |
1916 | if (bond->primary_slave == new_slave) | ||
1917 | bond->primary_slave = NULL; | ||
1906 | write_unlock_bh(&bond->lock); | 1918 | write_unlock_bh(&bond->lock); |
1919 | if (bond->curr_active_slave == new_slave) { | ||
1920 | read_lock(&bond->lock); | ||
1921 | write_lock_bh(&bond->curr_slave_lock); | ||
1922 | bond_change_active_slave(bond, NULL); | ||
1923 | bond_select_active_slave(bond); | ||
1924 | write_unlock_bh(&bond->curr_slave_lock); | ||
1925 | read_unlock(&bond->lock); | ||
1926 | } | ||
1927 | slave_disable_netpoll(new_slave); | ||
1907 | 1928 | ||
1908 | err_close: | 1929 | err_close: |
1930 | slave_dev->priv_flags &= ~IFF_BONDING; | ||
1909 | dev_close(slave_dev); | 1931 | dev_close(slave_dev); |
1910 | 1932 | ||
1911 | err_unset_master: | 1933 | err_unset_master: |
@@ -1976,12 +1998,11 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1976 | return -EINVAL; | 1998 | return -EINVAL; |
1977 | } | 1999 | } |
1978 | 2000 | ||
2001 | write_unlock_bh(&bond->lock); | ||
1979 | /* unregister rx_handler early so bond_handle_frame wouldn't be called | 2002 | /* unregister rx_handler early so bond_handle_frame wouldn't be called |
1980 | * for this slave anymore. | 2003 | * for this slave anymore. |
1981 | */ | 2004 | */ |
1982 | netdev_rx_handler_unregister(slave_dev); | 2005 | netdev_rx_handler_unregister(slave_dev); |
1983 | write_unlock_bh(&bond->lock); | ||
1984 | synchronize_net(); | ||
1985 | write_lock_bh(&bond->lock); | 2006 | write_lock_bh(&bond->lock); |
1986 | 2007 | ||
1987 | if (!all && !bond->params.fail_over_mac) { | 2008 | if (!all && !bond->params.fail_over_mac) { |
@@ -2374,8 +2395,6 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2374 | bond_set_backup_slave(slave); | 2395 | bond_set_backup_slave(slave); |
2375 | } | 2396 | } |
2376 | 2397 | ||
2377 | bond_update_speed_duplex(slave); | ||
2378 | |||
2379 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", | 2398 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", |
2380 | bond->dev->name, slave->dev->name, | 2399 | bond->dev->name, slave->dev->name, |
2381 | slave->speed, slave->duplex ? "full" : "half"); | 2400 | slave->speed, slave->duplex ? "full" : "half"); |
@@ -3171,11 +3190,20 @@ static int bond_slave_netdev_event(unsigned long event, | |||
3171 | struct net_device *slave_dev) | 3190 | struct net_device *slave_dev) |
3172 | { | 3191 | { |
3173 | struct slave *slave = bond_slave_get_rtnl(slave_dev); | 3192 | struct slave *slave = bond_slave_get_rtnl(slave_dev); |
3174 | struct bonding *bond = slave->bond; | 3193 | struct bonding *bond; |
3175 | struct net_device *bond_dev = slave->bond->dev; | 3194 | struct net_device *bond_dev; |
3176 | u32 old_speed; | 3195 | u32 old_speed; |
3177 | u8 old_duplex; | 3196 | u8 old_duplex; |
3178 | 3197 | ||
3198 | /* A netdev event can be generated while enslaving a device | ||
3199 | * before netdev_rx_handler_register is called in which case | ||
3200 | * slave will be NULL | ||
3201 | */ | ||
3202 | if (!slave) | ||
3203 | return NOTIFY_DONE; | ||
3204 | bond_dev = slave->bond->dev; | ||
3205 | bond = slave->bond; | ||
3206 | |||
3179 | switch (event) { | 3207 | switch (event) { |
3180 | case NETDEV_UNREGISTER: | 3208 | case NETDEV_UNREGISTER: |
3181 | if (bond->setup_by_slave) | 3209 | if (bond->setup_by_slave) |
@@ -3289,20 +3317,22 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count) | |||
3289 | */ | 3317 | */ |
3290 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) | 3318 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) |
3291 | { | 3319 | { |
3292 | struct ethhdr *data = (struct ethhdr *)skb->data; | 3320 | const struct ethhdr *data; |
3293 | struct iphdr *iph; | 3321 | const struct iphdr *iph; |
3294 | struct ipv6hdr *ipv6h; | 3322 | const struct ipv6hdr *ipv6h; |
3295 | u32 v6hash; | 3323 | u32 v6hash; |
3296 | __be32 *s, *d; | 3324 | const __be32 *s, *d; |
3297 | 3325 | ||
3298 | if (skb->protocol == htons(ETH_P_IP) && | 3326 | if (skb->protocol == htons(ETH_P_IP) && |
3299 | skb_network_header_len(skb) >= sizeof(*iph)) { | 3327 | pskb_network_may_pull(skb, sizeof(*iph))) { |
3300 | iph = ip_hdr(skb); | 3328 | iph = ip_hdr(skb); |
3329 | data = (struct ethhdr *)skb->data; | ||
3301 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ | 3330 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ |
3302 | (data->h_dest[5] ^ data->h_source[5])) % count; | 3331 | (data->h_dest[5] ^ data->h_source[5])) % count; |
3303 | } else if (skb->protocol == htons(ETH_P_IPV6) && | 3332 | } else if (skb->protocol == htons(ETH_P_IPV6) && |
3304 | skb_network_header_len(skb) >= sizeof(*ipv6h)) { | 3333 | pskb_network_may_pull(skb, sizeof(*ipv6h))) { |
3305 | ipv6h = ipv6_hdr(skb); | 3334 | ipv6h = ipv6_hdr(skb); |
3335 | data = (struct ethhdr *)skb->data; | ||
3306 | s = &ipv6h->saddr.s6_addr32[0]; | 3336 | s = &ipv6h->saddr.s6_addr32[0]; |
3307 | d = &ipv6h->daddr.s6_addr32[0]; | 3337 | d = &ipv6h->daddr.s6_addr32[0]; |
3308 | v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]); | 3338 | v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]); |
@@ -3321,33 +3351,36 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) | |||
3321 | static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) | 3351 | static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) |
3322 | { | 3352 | { |
3323 | u32 layer4_xor = 0; | 3353 | u32 layer4_xor = 0; |
3324 | struct iphdr *iph; | 3354 | const struct iphdr *iph; |
3325 | struct ipv6hdr *ipv6h; | 3355 | const struct ipv6hdr *ipv6h; |
3326 | __be32 *s, *d; | 3356 | const __be32 *s, *d; |
3327 | __be16 *layer4hdr; | 3357 | const __be16 *l4 = NULL; |
3358 | __be16 _l4[2]; | ||
3359 | int noff = skb_network_offset(skb); | ||
3360 | int poff; | ||
3328 | 3361 | ||
3329 | if (skb->protocol == htons(ETH_P_IP) && | 3362 | if (skb->protocol == htons(ETH_P_IP) && |
3330 | skb_network_header_len(skb) >= sizeof(*iph)) { | 3363 | pskb_may_pull(skb, noff + sizeof(*iph))) { |
3331 | iph = ip_hdr(skb); | 3364 | iph = ip_hdr(skb); |
3332 | if (!ip_is_fragment(iph) && | 3365 | poff = proto_ports_offset(iph->protocol); |
3333 | (iph->protocol == IPPROTO_TCP || | 3366 | |
3334 | iph->protocol == IPPROTO_UDP) && | 3367 | if (!ip_is_fragment(iph) && poff >= 0) { |
3335 | (skb_headlen(skb) - skb_network_offset(skb) >= | 3368 | l4 = skb_header_pointer(skb, noff + (iph->ihl << 2) + poff, |
3336 | iph->ihl * sizeof(u32) + sizeof(*layer4hdr) * 2)) { | 3369 | sizeof(_l4), &_l4); |
3337 | layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); | 3370 | if (l4) |
3338 | layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); | 3371 | layer4_xor = ntohs(l4[0] ^ l4[1]); |
3339 | } | 3372 | } |
3340 | return (layer4_xor ^ | 3373 | return (layer4_xor ^ |
3341 | ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; | 3374 | ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; |
3342 | } else if (skb->protocol == htons(ETH_P_IPV6) && | 3375 | } else if (skb->protocol == htons(ETH_P_IPV6) && |
3343 | skb_network_header_len(skb) >= sizeof(*ipv6h)) { | 3376 | pskb_may_pull(skb, noff + sizeof(*ipv6h))) { |
3344 | ipv6h = ipv6_hdr(skb); | 3377 | ipv6h = ipv6_hdr(skb); |
3345 | if ((ipv6h->nexthdr == IPPROTO_TCP || | 3378 | poff = proto_ports_offset(ipv6h->nexthdr); |
3346 | ipv6h->nexthdr == IPPROTO_UDP) && | 3379 | if (poff >= 0) { |
3347 | (skb_headlen(skb) - skb_network_offset(skb) >= | 3380 | l4 = skb_header_pointer(skb, noff + sizeof(*ipv6h) + poff, |
3348 | sizeof(*ipv6h) + sizeof(*layer4hdr) * 2)) { | 3381 | sizeof(_l4), &_l4); |
3349 | layer4hdr = (__be16 *)(ipv6h + 1); | 3382 | if (l4) |
3350 | layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); | 3383 | layer4_xor = ntohs(l4[0] ^ l4[1]); |
3351 | } | 3384 | } |
3352 | s = &ipv6h->saddr.s6_addr32[0]; | 3385 | s = &ipv6h->saddr.s6_addr32[0]; |
3353 | d = &ipv6h->daddr.s6_addr32[0]; | 3386 | d = &ipv6h->daddr.s6_addr32[0]; |
@@ -4849,9 +4882,18 @@ static int __net_init bond_net_init(struct net *net) | |||
4849 | static void __net_exit bond_net_exit(struct net *net) | 4882 | static void __net_exit bond_net_exit(struct net *net) |
4850 | { | 4883 | { |
4851 | struct bond_net *bn = net_generic(net, bond_net_id); | 4884 | struct bond_net *bn = net_generic(net, bond_net_id); |
4885 | struct bonding *bond, *tmp_bond; | ||
4886 | LIST_HEAD(list); | ||
4852 | 4887 | ||
4853 | bond_destroy_sysfs(bn); | 4888 | bond_destroy_sysfs(bn); |
4854 | bond_destroy_proc_dir(bn); | 4889 | bond_destroy_proc_dir(bn); |
4890 | |||
4891 | /* Kill off any bonds created after unregistering bond rtnl ops */ | ||
4892 | rtnl_lock(); | ||
4893 | list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) | ||
4894 | unregister_netdevice_queue(bond->dev, &list); | ||
4895 | unregister_netdevice_many(&list); | ||
4896 | rtnl_unlock(); | ||
4855 | } | 4897 | } |
4856 | 4898 | ||
4857 | static struct pernet_operations bond_net_ops = { | 4899 | static struct pernet_operations bond_net_ops = { |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1c9e09fbdff8..ea7a388f4843 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -183,6 +183,11 @@ int bond_create_slave_symlinks(struct net_device *master, | |||
183 | sprintf(linkname, "slave_%s", slave->name); | 183 | sprintf(linkname, "slave_%s", slave->name); |
184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), | 184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), |
185 | linkname); | 185 | linkname); |
186 | |||
187 | /* free the master link created earlier in case of error */ | ||
188 | if (ret) | ||
189 | sysfs_remove_link(&(slave->dev.kobj), "master"); | ||
190 | |||
186 | return ret; | 191 | return ret; |
187 | 192 | ||
188 | } | 193 | } |
@@ -522,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
522 | goto out; | 527 | goto out; |
523 | } | 528 | } |
524 | if (new_value < 0) { | 529 | if (new_value < 0) { |
525 | pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | 530 | pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", |
526 | bond->dev->name, new_value, INT_MAX); | 531 | bond->dev->name, new_value, INT_MAX); |
527 | ret = -EINVAL; | 532 | ret = -EINVAL; |
528 | goto out; | 533 | goto out; |
@@ -537,14 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
537 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 542 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
538 | bond->dev->name, new_value); | 543 | bond->dev->name, new_value); |
539 | bond->params.arp_interval = new_value; | 544 | bond->params.arp_interval = new_value; |
540 | if (bond->params.miimon) { | 545 | if (new_value) { |
541 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | 546 | if (bond->params.miimon) { |
542 | bond->dev->name, bond->dev->name); | 547 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
543 | bond->params.miimon = 0; | 548 | bond->dev->name, bond->dev->name); |
544 | } | 549 | bond->params.miimon = 0; |
545 | if (!bond->params.arp_targets[0]) { | 550 | } |
546 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | 551 | if (!bond->params.arp_targets[0]) |
547 | bond->dev->name); | 552 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
553 | bond->dev->name); | ||
548 | } | 554 | } |
549 | if (bond->dev->flags & IFF_UP) { | 555 | if (bond->dev->flags & IFF_UP) { |
550 | /* If the interface is up, we may need to fire off | 556 | /* If the interface is up, we may need to fire off |
@@ -552,10 +558,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
552 | * timer will get fired off when the open function | 558 | * timer will get fired off when the open function |
553 | * is called. | 559 | * is called. |
554 | */ | 560 | */ |
555 | cancel_delayed_work_sync(&bond->mii_work); | 561 | if (!new_value) { |
556 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | 562 | cancel_delayed_work_sync(&bond->arp_work); |
563 | } else { | ||
564 | cancel_delayed_work_sync(&bond->mii_work); | ||
565 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | ||
566 | } | ||
557 | } | 567 | } |
558 | |||
559 | out: | 568 | out: |
560 | rtnl_unlock(); | 569 | rtnl_unlock(); |
561 | return ret; | 570 | return ret; |
@@ -697,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
697 | } | 706 | } |
698 | if (new_value < 0) { | 707 | if (new_value < 0) { |
699 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 708 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
700 | bond->dev->name, new_value, 1, INT_MAX); | 709 | bond->dev->name, new_value, 0, INT_MAX); |
701 | ret = -EINVAL; | 710 | ret = -EINVAL; |
702 | goto out; | 711 | goto out; |
703 | } else { | 712 | } else { |
@@ -752,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
752 | goto out; | 761 | goto out; |
753 | } | 762 | } |
754 | if (new_value < 0) { | 763 | if (new_value < 0) { |
755 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 764 | pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", |
756 | bond->dev->name, new_value, 1, INT_MAX); | 765 | bond->dev->name, new_value, 0, INT_MAX); |
757 | ret = -EINVAL; | 766 | ret = -EINVAL; |
758 | goto out; | 767 | goto out; |
759 | } else { | 768 | } else { |
@@ -963,37 +972,37 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
963 | } | 972 | } |
964 | if (new_value < 0) { | 973 | if (new_value < 0) { |
965 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", | 974 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
966 | bond->dev->name, new_value, 1, INT_MAX); | 975 | bond->dev->name, new_value, 0, INT_MAX); |
967 | ret = -EINVAL; | 976 | ret = -EINVAL; |
968 | goto out; | 977 | goto out; |
969 | } else { | 978 | } |
970 | pr_info("%s: Setting MII monitoring interval to %d.\n", | 979 | pr_info("%s: Setting MII monitoring interval to %d.\n", |
971 | bond->dev->name, new_value); | 980 | bond->dev->name, new_value); |
972 | bond->params.miimon = new_value; | 981 | bond->params.miimon = new_value; |
973 | if (bond->params.updelay) | 982 | if (bond->params.updelay) |
974 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", | 983 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", |
975 | bond->dev->name, | 984 | bond->dev->name, |
976 | bond->params.updelay * bond->params.miimon); | 985 | bond->params.updelay * bond->params.miimon); |
977 | if (bond->params.downdelay) | 986 | if (bond->params.downdelay) |
978 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", | 987 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", |
979 | bond->dev->name, | 988 | bond->dev->name, |
980 | bond->params.downdelay * bond->params.miimon); | 989 | bond->params.downdelay * bond->params.miimon); |
981 | if (bond->params.arp_interval) { | 990 | if (new_value && bond->params.arp_interval) { |
982 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | 991 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
983 | bond->dev->name); | 992 | bond->dev->name); |
984 | bond->params.arp_interval = 0; | 993 | bond->params.arp_interval = 0; |
985 | if (bond->params.arp_validate) { | 994 | if (bond->params.arp_validate) |
986 | bond->params.arp_validate = | 995 | bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; |
987 | BOND_ARP_VALIDATE_NONE; | 996 | } |
988 | } | 997 | if (bond->dev->flags & IFF_UP) { |
989 | } | 998 | /* If the interface is up, we may need to fire off |
990 | 999 | * the MII timer. If the interface is down, the | |
991 | if (bond->dev->flags & IFF_UP) { | 1000 | * timer will get fired off when the open function |
992 | /* If the interface is up, we may need to fire off | 1001 | * is called. |
993 | * the MII timer. If the interface is down, the | 1002 | */ |
994 | * timer will get fired off when the open function | 1003 | if (!new_value) { |
995 | * is called. | 1004 | cancel_delayed_work_sync(&bond->mii_work); |
996 | */ | 1005 | } else { |
997 | cancel_delayed_work_sync(&bond->arp_work); | 1006 | cancel_delayed_work_sync(&bond->arp_work); |
998 | queue_delayed_work(bond->wq, &bond->mii_work, 0); | 1007 | queue_delayed_work(bond->wq, &bond->mii_work, 0); |
999 | } | 1008 | } |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index f32b9fc6a983..9aa0c64c33c8 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -929,6 +929,7 @@ static int mcp251x_open(struct net_device *net) | |||
929 | struct mcp251x_priv *priv = netdev_priv(net); | 929 | struct mcp251x_priv *priv = netdev_priv(net); |
930 | struct spi_device *spi = priv->spi; | 930 | struct spi_device *spi = priv->spi; |
931 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; | 931 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; |
932 | unsigned long flags; | ||
932 | int ret; | 933 | int ret; |
933 | 934 | ||
934 | ret = open_candev(net); | 935 | ret = open_candev(net); |
@@ -945,9 +946,14 @@ static int mcp251x_open(struct net_device *net) | |||
945 | priv->tx_skb = NULL; | 946 | priv->tx_skb = NULL; |
946 | priv->tx_len = 0; | 947 | priv->tx_len = 0; |
947 | 948 | ||
949 | flags = IRQF_ONESHOT; | ||
950 | if (pdata->irq_flags) | ||
951 | flags |= pdata->irq_flags; | ||
952 | else | ||
953 | flags |= IRQF_TRIGGER_FALLING; | ||
954 | |||
948 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, | 955 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, |
949 | pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, | 956 | flags, DEVICE_NAME, priv); |
950 | DEVICE_NAME, priv); | ||
951 | if (ret) { | 957 | if (ret) { |
952 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); | 958 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); |
953 | if (pdata->transceiver_enable) | 959 | if (pdata->transceiver_enable) |
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig index b39ca5b3ea7f..ff2ba86cd4a4 100644 --- a/drivers/net/can/sja1000/Kconfig +++ b/drivers/net/can/sja1000/Kconfig | |||
@@ -46,6 +46,7 @@ config CAN_EMS_PCI | |||
46 | config CAN_PEAK_PCMCIA | 46 | config CAN_PEAK_PCMCIA |
47 | tristate "PEAK PCAN-PC Card" | 47 | tristate "PEAK PCAN-PC Card" |
48 | depends on PCMCIA | 48 | depends on PCMCIA |
49 | depends on HAS_IOPORT | ||
49 | ---help--- | 50 | ---help--- |
50 | This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) | 51 | This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) |
51 | from PEAK-System (http://www.peak-system.com). To compile this | 52 | from PEAK-System (http://www.peak-system.com). To compile this |
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c index a042cdc260dc..3c18d7d000ed 100644 --- a/drivers/net/can/sja1000/plx_pci.c +++ b/drivers/net/can/sja1000/plx_pci.c | |||
@@ -348,7 +348,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
348 | */ | 348 | */ |
349 | if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == | 349 | if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == |
350 | REG_CR_BASICCAN_INITIAL && | 350 | REG_CR_BASICCAN_INITIAL && |
351 | (priv->read_reg(priv, REG_SR) == REG_SR_BASICCAN_INITIAL) && | 351 | (priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_BASICCAN_INITIAL) && |
352 | (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) | 352 | (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) |
353 | flag = 1; | 353 | flag = 1; |
354 | 354 | ||
@@ -360,7 +360,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
360 | * See states on p. 23 of the Datasheet. | 360 | * See states on p. 23 of the Datasheet. |
361 | */ | 361 | */ |
362 | if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && | 362 | if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && |
363 | priv->read_reg(priv, REG_SR) == REG_SR_PELICAN_INITIAL && | 363 | priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_PELICAN_INITIAL && |
364 | priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) | 364 | priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) |
365 | return flag; | 365 | return flag; |
366 | 366 | ||
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index daf4013a8fc7..e4df307eaa90 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -92,7 +92,7 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val) | |||
92 | */ | 92 | */ |
93 | spin_lock_irqsave(&priv->cmdreg_lock, flags); | 93 | spin_lock_irqsave(&priv->cmdreg_lock, flags); |
94 | priv->write_reg(priv, REG_CMR, val); | 94 | priv->write_reg(priv, REG_CMR, val); |
95 | priv->read_reg(priv, REG_SR); | 95 | priv->read_reg(priv, SJA1000_REG_SR); |
96 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); | 96 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); |
97 | } | 97 | } |
98 | 98 | ||
@@ -502,7 +502,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
502 | 502 | ||
503 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { | 503 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { |
504 | n++; | 504 | n++; |
505 | status = priv->read_reg(priv, REG_SR); | 505 | status = priv->read_reg(priv, SJA1000_REG_SR); |
506 | /* check for absent controller due to hw unplug */ | 506 | /* check for absent controller due to hw unplug */ |
507 | if (status == 0xFF && sja1000_is_absent(priv)) | 507 | if (status == 0xFF && sja1000_is_absent(priv)) |
508 | return IRQ_NONE; | 508 | return IRQ_NONE; |
@@ -530,7 +530,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
530 | /* receive interrupt */ | 530 | /* receive interrupt */ |
531 | while (status & SR_RBS) { | 531 | while (status & SR_RBS) { |
532 | sja1000_rx(dev); | 532 | sja1000_rx(dev); |
533 | status = priv->read_reg(priv, REG_SR); | 533 | status = priv->read_reg(priv, SJA1000_REG_SR); |
534 | /* check for absent controller */ | 534 | /* check for absent controller */ |
535 | if (status == 0xFF && sja1000_is_absent(priv)) | 535 | if (status == 0xFF && sja1000_is_absent(priv)) |
536 | return IRQ_NONE; | 536 | return IRQ_NONE; |
diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h index afa99847a510..aa48e053da27 100644 --- a/drivers/net/can/sja1000/sja1000.h +++ b/drivers/net/can/sja1000/sja1000.h | |||
@@ -56,7 +56,7 @@ | |||
56 | /* SJA1000 registers - manual section 6.4 (Pelican Mode) */ | 56 | /* SJA1000 registers - manual section 6.4 (Pelican Mode) */ |
57 | #define REG_MOD 0x00 | 57 | #define REG_MOD 0x00 |
58 | #define REG_CMR 0x01 | 58 | #define REG_CMR 0x01 |
59 | #define REG_SR 0x02 | 59 | #define SJA1000_REG_SR 0x02 |
60 | #define REG_IR 0x03 | 60 | #define REG_IR 0x03 |
61 | #define REG_IER 0x04 | 61 | #define REG_IER 0x04 |
62 | #define REG_ALC 0x0B | 62 | #define REG_ALC 0x0B |
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c index 6433b81256cd..8e0c4a001939 100644 --- a/drivers/net/can/sja1000/sja1000_of_platform.c +++ b/drivers/net/can/sja1000/sja1000_of_platform.c | |||
@@ -96,8 +96,8 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) | |||
96 | struct net_device *dev; | 96 | struct net_device *dev; |
97 | struct sja1000_priv *priv; | 97 | struct sja1000_priv *priv; |
98 | struct resource res; | 98 | struct resource res; |
99 | const u32 *prop; | 99 | u32 prop; |
100 | int err, irq, res_size, prop_size; | 100 | int err, irq, res_size; |
101 | void __iomem *base; | 101 | void __iomem *base; |
102 | 102 | ||
103 | err = of_address_to_resource(np, 0, &res); | 103 | err = of_address_to_resource(np, 0, &res); |
@@ -138,27 +138,27 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) | |||
138 | priv->read_reg = sja1000_ofp_read_reg; | 138 | priv->read_reg = sja1000_ofp_read_reg; |
139 | priv->write_reg = sja1000_ofp_write_reg; | 139 | priv->write_reg = sja1000_ofp_write_reg; |
140 | 140 | ||
141 | prop = of_get_property(np, "nxp,external-clock-frequency", &prop_size); | 141 | err = of_property_read_u32(np, "nxp,external-clock-frequency", &prop); |
142 | if (prop && (prop_size == sizeof(u32))) | 142 | if (!err) |
143 | priv->can.clock.freq = *prop / 2; | 143 | priv->can.clock.freq = prop / 2; |
144 | else | 144 | else |
145 | priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ | 145 | priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ |
146 | 146 | ||
147 | prop = of_get_property(np, "nxp,tx-output-mode", &prop_size); | 147 | err = of_property_read_u32(np, "nxp,tx-output-mode", &prop); |
148 | if (prop && (prop_size == sizeof(u32))) | 148 | if (!err) |
149 | priv->ocr |= *prop & OCR_MODE_MASK; | 149 | priv->ocr |= prop & OCR_MODE_MASK; |
150 | else | 150 | else |
151 | priv->ocr |= OCR_MODE_NORMAL; /* default */ | 151 | priv->ocr |= OCR_MODE_NORMAL; /* default */ |
152 | 152 | ||
153 | prop = of_get_property(np, "nxp,tx-output-config", &prop_size); | 153 | err = of_property_read_u32(np, "nxp,tx-output-config", &prop); |
154 | if (prop && (prop_size == sizeof(u32))) | 154 | if (!err) |
155 | priv->ocr |= (*prop << OCR_TX_SHIFT) & OCR_TX_MASK; | 155 | priv->ocr |= (prop << OCR_TX_SHIFT) & OCR_TX_MASK; |
156 | else | 156 | else |
157 | priv->ocr |= OCR_TX0_PULLDOWN; /* default */ | 157 | priv->ocr |= OCR_TX0_PULLDOWN; /* default */ |
158 | 158 | ||
159 | prop = of_get_property(np, "nxp,clock-out-frequency", &prop_size); | 159 | err = of_property_read_u32(np, "nxp,clock-out-frequency", &prop); |
160 | if (prop && (prop_size == sizeof(u32)) && *prop) { | 160 | if (!err && prop) { |
161 | u32 divider = priv->can.clock.freq * 2 / *prop; | 161 | u32 divider = priv->can.clock.freq * 2 / prop; |
162 | 162 | ||
163 | if (divider > 1) | 163 | if (divider > 1) |
164 | priv->cdr |= divider / 2 - 1; | 164 | priv->cdr |= divider / 2 - 1; |
@@ -168,8 +168,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) | |||
168 | priv->cdr |= CDR_CLK_OFF; /* default */ | 168 | priv->cdr |= CDR_CLK_OFF; /* default */ |
169 | } | 169 | } |
170 | 170 | ||
171 | prop = of_get_property(np, "nxp,no-comparator-bypass", NULL); | 171 | if (!of_property_read_bool(np, "nxp,no-comparator-bypass")) |
172 | if (!prop) | ||
173 | priv->cdr |= CDR_CBP; /* default */ | 172 | priv->cdr |= CDR_CBP; /* default */ |
174 | 173 | ||
175 | priv->irq_flags = IRQF_SHARED; | 174 | priv->irq_flags = IRQF_SHARED; |
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index cab306a9888e..e1d26433d619 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c | |||
@@ -828,7 +828,7 @@ static int ax_probe(struct platform_device *pdev) | |||
828 | struct ei_device *ei_local; | 828 | struct ei_device *ei_local; |
829 | struct ax_device *ax; | 829 | struct ax_device *ax; |
830 | struct resource *irq, *mem, *mem2; | 830 | struct resource *irq, *mem, *mem2; |
831 | resource_size_t mem_size, mem2_size = 0; | 831 | unsigned long mem_size, mem2_size = 0; |
832 | int ret = 0; | 832 | int ret = 0; |
833 | 833 | ||
834 | dev = ax__alloc_ei_netdev(sizeof(struct ax_device)); | 834 | dev = ax__alloc_ei_netdev(sizeof(struct ax_device)); |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h index 829b5ad71d0d..b5fd934585e9 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e.h +++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h | |||
@@ -186,7 +186,7 @@ struct atl1e_tpd_desc { | |||
186 | /* how about 0x2000 */ | 186 | /* how about 0x2000 */ |
187 | #define MAX_TX_BUF_LEN 0x2000 | 187 | #define MAX_TX_BUF_LEN 0x2000 |
188 | #define MAX_TX_BUF_SHIFT 13 | 188 | #define MAX_TX_BUF_SHIFT 13 |
189 | /*#define MAX_TX_BUF_LEN 0x3000 */ | 189 | #define MAX_TSO_SEG_SIZE 0x3c00 |
190 | 190 | ||
191 | /* rrs word 1 bit 0:31 */ | 191 | /* rrs word 1 bit 0:31 */ |
192 | #define RRS_RX_CSUM_MASK 0xFFFF | 192 | #define RRS_RX_CSUM_MASK 0xFFFF |
@@ -438,7 +438,6 @@ struct atl1e_adapter { | |||
438 | struct atl1e_hw hw; | 438 | struct atl1e_hw hw; |
439 | struct atl1e_hw_stats hw_stats; | 439 | struct atl1e_hw_stats hw_stats; |
440 | 440 | ||
441 | bool have_msi; | ||
442 | u32 wol; | 441 | u32 wol; |
443 | u16 link_speed; | 442 | u16 link_speed; |
444 | u16 link_duplex; | 443 | u16 link_duplex; |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 92f4734f860d..ac25f05ff68f 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c | |||
@@ -1849,34 +1849,19 @@ static void atl1e_free_irq(struct atl1e_adapter *adapter) | |||
1849 | struct net_device *netdev = adapter->netdev; | 1849 | struct net_device *netdev = adapter->netdev; |
1850 | 1850 | ||
1851 | free_irq(adapter->pdev->irq, netdev); | 1851 | free_irq(adapter->pdev->irq, netdev); |
1852 | |||
1853 | if (adapter->have_msi) | ||
1854 | pci_disable_msi(adapter->pdev); | ||
1855 | } | 1852 | } |
1856 | 1853 | ||
1857 | static int atl1e_request_irq(struct atl1e_adapter *adapter) | 1854 | static int atl1e_request_irq(struct atl1e_adapter *adapter) |
1858 | { | 1855 | { |
1859 | struct pci_dev *pdev = adapter->pdev; | 1856 | struct pci_dev *pdev = adapter->pdev; |
1860 | struct net_device *netdev = adapter->netdev; | 1857 | struct net_device *netdev = adapter->netdev; |
1861 | int flags = 0; | ||
1862 | int err = 0; | 1858 | int err = 0; |
1863 | 1859 | ||
1864 | adapter->have_msi = true; | 1860 | err = request_irq(pdev->irq, atl1e_intr, IRQF_SHARED, netdev->name, |
1865 | err = pci_enable_msi(pdev); | 1861 | netdev); |
1866 | if (err) { | ||
1867 | netdev_dbg(netdev, | ||
1868 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
1869 | adapter->have_msi = false; | ||
1870 | } | ||
1871 | |||
1872 | if (!adapter->have_msi) | ||
1873 | flags |= IRQF_SHARED; | ||
1874 | err = request_irq(pdev->irq, atl1e_intr, flags, netdev->name, netdev); | ||
1875 | if (err) { | 1862 | if (err) { |
1876 | netdev_dbg(adapter->netdev, | 1863 | netdev_dbg(adapter->netdev, |
1877 | "Unable to allocate interrupt Error: %d\n", err); | 1864 | "Unable to allocate interrupt Error: %d\n", err); |
1878 | if (adapter->have_msi) | ||
1879 | pci_disable_msi(pdev); | ||
1880 | return err; | 1865 | return err; |
1881 | } | 1866 | } |
1882 | netdev_dbg(netdev, "atl1e_request_irq OK\n"); | 1867 | netdev_dbg(netdev, "atl1e_request_irq OK\n"); |
@@ -2344,6 +2329,7 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2344 | 2329 | ||
2345 | INIT_WORK(&adapter->reset_task, atl1e_reset_task); | 2330 | INIT_WORK(&adapter->reset_task, atl1e_reset_task); |
2346 | INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); | 2331 | INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); |
2332 | netif_set_gso_max_size(netdev, MAX_TSO_SEG_SIZE); | ||
2347 | err = register_netdev(netdev); | 2333 | err = register_netdev(netdev); |
2348 | if (err) { | 2334 | if (err) { |
2349 | netdev_err(netdev, "register netdevice failed\n"); | 2335 | netdev_err(netdev, "register netdevice failed\n"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index a923bc4d5a1f..57619dd4a92b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2614,6 +2614,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
2614 | } | 2614 | } |
2615 | } | 2615 | } |
2616 | 2616 | ||
2617 | /* initialize FW coalescing state machines in RAM */ | ||
2618 | bnx2x_update_coalesce(bp); | ||
2619 | |||
2617 | /* setup the leading queue */ | 2620 | /* setup the leading queue */ |
2618 | rc = bnx2x_setup_leading(bp); | 2621 | rc = bnx2x_setup_leading(bp); |
2619 | if (rc) { | 2622 | if (rc) { |
@@ -2760,6 +2763,7 @@ load_error2: | |||
2760 | bp->port.pmf = 0; | 2763 | bp->port.pmf = 0; |
2761 | load_error1: | 2764 | load_error1: |
2762 | bnx2x_napi_disable(bp); | 2765 | bnx2x_napi_disable(bp); |
2766 | bnx2x_del_all_napi(bp); | ||
2763 | 2767 | ||
2764 | /* clear pf_load status, as it was already set */ | 2768 | /* clear pf_load status, as it was already set */ |
2765 | if (IS_PF(bp)) | 2769 | if (IS_PF(bp)) |
@@ -4579,11 +4583,11 @@ static void storm_memset_hc_disable(struct bnx2x *bp, u8 port, | |||
4579 | u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT); | 4583 | u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT); |
4580 | u32 addr = BAR_CSTRORM_INTMEM + | 4584 | u32 addr = BAR_CSTRORM_INTMEM + |
4581 | CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index); | 4585 | CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index); |
4582 | u16 flags = REG_RD16(bp, addr); | 4586 | u8 flags = REG_RD8(bp, addr); |
4583 | /* clear and set */ | 4587 | /* clear and set */ |
4584 | flags &= ~HC_INDEX_DATA_HC_ENABLED; | 4588 | flags &= ~HC_INDEX_DATA_HC_ENABLED; |
4585 | flags |= enable_flag; | 4589 | flags |= enable_flag; |
4586 | REG_WR16(bp, addr, flags); | 4590 | REG_WR8(bp, addr, flags); |
4587 | DP(NETIF_MSG_IFUP, | 4591 | DP(NETIF_MSG_IFUP, |
4588 | "port %x fw_sb_id %d sb_index %d disable %d\n", | 4592 | "port %x fw_sb_id %d sb_index %d disable %d\n", |
4589 | port, fw_sb_id, sb_index, disable); | 4593 | port, fw_sb_id, sb_index, disable); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c index 568205436a15..91ecd6a00d05 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | |||
@@ -2139,12 +2139,12 @@ static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap) | |||
2139 | break; | 2139 | break; |
2140 | default: | 2140 | default: |
2141 | BNX2X_ERR("Non valid capability ID\n"); | 2141 | BNX2X_ERR("Non valid capability ID\n"); |
2142 | rval = -EINVAL; | 2142 | rval = 1; |
2143 | break; | 2143 | break; |
2144 | } | 2144 | } |
2145 | } else { | 2145 | } else { |
2146 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2146 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2147 | rval = -EINVAL; | 2147 | rval = 1; |
2148 | } | 2148 | } |
2149 | 2149 | ||
2150 | DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap); | 2150 | DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap); |
@@ -2170,12 +2170,12 @@ static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num) | |||
2170 | break; | 2170 | break; |
2171 | default: | 2171 | default: |
2172 | BNX2X_ERR("Non valid TC-ID\n"); | 2172 | BNX2X_ERR("Non valid TC-ID\n"); |
2173 | rval = -EINVAL; | 2173 | rval = 1; |
2174 | break; | 2174 | break; |
2175 | } | 2175 | } |
2176 | } else { | 2176 | } else { |
2177 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2177 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2178 | rval = -EINVAL; | 2178 | rval = 1; |
2179 | } | 2179 | } |
2180 | 2180 | ||
2181 | return rval; | 2181 | return rval; |
@@ -2188,7 +2188,7 @@ static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num) | |||
2188 | return -EINVAL; | 2188 | return -EINVAL; |
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev) | 2191 | static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev) |
2192 | { | 2192 | { |
2193 | struct bnx2x *bp = netdev_priv(netdev); | 2193 | struct bnx2x *bp = netdev_priv(netdev); |
2194 | DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled); | 2194 | DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled); |
@@ -2390,12 +2390,12 @@ static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid, | |||
2390 | break; | 2390 | break; |
2391 | default: | 2391 | default: |
2392 | BNX2X_ERR("Non valid featrue-ID\n"); | 2392 | BNX2X_ERR("Non valid featrue-ID\n"); |
2393 | rval = -EINVAL; | 2393 | rval = 1; |
2394 | break; | 2394 | break; |
2395 | } | 2395 | } |
2396 | } else { | 2396 | } else { |
2397 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2397 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2398 | rval = -EINVAL; | 2398 | rval = 1; |
2399 | } | 2399 | } |
2400 | 2400 | ||
2401 | return rval; | 2401 | return rval; |
@@ -2431,12 +2431,12 @@ static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid, | |||
2431 | break; | 2431 | break; |
2432 | default: | 2432 | default: |
2433 | BNX2X_ERR("Non valid featrue-ID\n"); | 2433 | BNX2X_ERR("Non valid featrue-ID\n"); |
2434 | rval = -EINVAL; | 2434 | rval = 1; |
2435 | break; | 2435 | break; |
2436 | } | 2436 | } |
2437 | } else { | 2437 | } else { |
2438 | DP(BNX2X_MSG_DCB, "dcbnl call not valid\n"); | 2438 | DP(BNX2X_MSG_DCB, "dcbnl call not valid\n"); |
2439 | rval = -EINVAL; | 2439 | rval = 1; |
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | return rval; | 2442 | return rval; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 77ebae0ac64a..0283f343b0d1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -13437,13 +13437,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13437 | { | 13437 | { |
13438 | struct bnx2x *bp = params->bp; | 13438 | struct bnx2x *bp = params->bp; |
13439 | u16 base_page, next_page, not_kr2_device, lane; | 13439 | u16 base_page, next_page, not_kr2_device, lane; |
13440 | int sigdet = bnx2x_warpcore_get_sigdet(phy, params); | 13440 | int sigdet; |
13441 | |||
13442 | if (!sigdet) { | ||
13443 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) | ||
13444 | bnx2x_kr2_recovery(params, vars, phy); | ||
13445 | return; | ||
13446 | } | ||
13447 | 13441 | ||
13448 | /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery | 13442 | /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery |
13449 | * since some switches tend to reinit the AN process and clear the | 13443 | * since some switches tend to reinit the AN process and clear the |
@@ -13454,6 +13448,16 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13454 | vars->check_kr2_recovery_cnt--; | 13448 | vars->check_kr2_recovery_cnt--; |
13455 | return; | 13449 | return; |
13456 | } | 13450 | } |
13451 | |||
13452 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); | ||
13453 | if (!sigdet) { | ||
13454 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | ||
13455 | bnx2x_kr2_recovery(params, vars, phy); | ||
13456 | DP(NETIF_MSG_LINK, "No sigdet\n"); | ||
13457 | } | ||
13458 | return; | ||
13459 | } | ||
13460 | |||
13457 | lane = bnx2x_get_warpcore_lane(phy, params); | 13461 | lane = bnx2x_get_warpcore_lane(phy, params); |
13458 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | 13462 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
13459 | MDIO_AER_BLOCK_AER_REG, lane); | 13463 | MDIO_AER_BLOCK_AER_REG, lane); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e81a747ea8ce..c50696b396f1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -4947,7 +4947,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp) | |||
4947 | q); | 4947 | q); |
4948 | } | 4948 | } |
4949 | 4949 | ||
4950 | if (!NO_FCOE(bp)) { | 4950 | if (!NO_FCOE(bp) && CNIC_ENABLED(bp)) { |
4951 | fp = &bp->fp[FCOE_IDX(bp)]; | 4951 | fp = &bp->fp[FCOE_IDX(bp)]; |
4952 | queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; | 4952 | queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
4953 | 4953 | ||
@@ -9878,6 +9878,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) | |||
9878 | REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0); | 9878 | REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0); |
9879 | } | 9879 | } |
9880 | } | 9880 | } |
9881 | if (!CHIP_IS_E1x(bp)) | ||
9882 | /* block FW from writing to host */ | ||
9883 | REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_MASTER, 0); | ||
9884 | |||
9881 | /* wait until BRB is empty */ | 9885 | /* wait until BRB is empty */ |
9882 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); | 9886 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); |
9883 | while (timer_count) { | 9887 | while (timer_count) { |
@@ -13354,6 +13358,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev) | |||
13354 | RCU_INIT_POINTER(bp->cnic_ops, NULL); | 13358 | RCU_INIT_POINTER(bp->cnic_ops, NULL); |
13355 | mutex_unlock(&bp->cnic_mutex); | 13359 | mutex_unlock(&bp->cnic_mutex); |
13356 | synchronize_rcu(); | 13360 | synchronize_rcu(); |
13361 | bp->cnic_enabled = false; | ||
13357 | kfree(bp->cnic_kwq); | 13362 | kfree(bp->cnic_kwq); |
13358 | bp->cnic_kwq = NULL; | 13363 | bp->cnic_kwq = NULL; |
13359 | 13364 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h index 364e37ecbc5c..198f6f1c9ad5 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | |||
@@ -459,8 +459,9 @@ struct bnx2x_fw_port_stats_old { | |||
459 | 459 | ||
460 | #define UPDATE_QSTAT(s, t) \ | 460 | #define UPDATE_QSTAT(s, t) \ |
461 | do { \ | 461 | do { \ |
462 | qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \ | ||
463 | qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ | 462 | qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ |
463 | qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \ | ||
464 | + ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \ | ||
464 | } while (0) | 465 | } while (0) |
465 | 466 | ||
466 | #define UPDATE_QSTAT_OLD(f) \ | 467 | #define UPDATE_QSTAT_OLD(f) \ |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 93729f942358..17a972734ba7 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -4130,6 +4130,14 @@ static void tg3_phy_copper_begin(struct tg3 *tp) | |||
4130 | tp->link_config.active_speed = tp->link_config.speed; | 4130 | tp->link_config.active_speed = tp->link_config.speed; |
4131 | tp->link_config.active_duplex = tp->link_config.duplex; | 4131 | tp->link_config.active_duplex = tp->link_config.duplex; |
4132 | 4132 | ||
4133 | if (tg3_asic_rev(tp) == ASIC_REV_5714) { | ||
4134 | /* With autoneg disabled, 5715 only links up when the | ||
4135 | * advertisement register has the configured speed | ||
4136 | * enabled. | ||
4137 | */ | ||
4138 | tg3_writephy(tp, MII_ADVERTISE, ADVERTISE_ALL); | ||
4139 | } | ||
4140 | |||
4133 | bmcr = 0; | 4141 | bmcr = 0; |
4134 | switch (tp->link_config.speed) { | 4142 | switch (tp->link_config.speed) { |
4135 | default: | 4143 | default: |
@@ -14596,8 +14604,11 @@ static void tg3_read_vpd(struct tg3 *tp) | |||
14596 | if (j + len > block_end) | 14604 | if (j + len > block_end) |
14597 | goto partno; | 14605 | goto partno; |
14598 | 14606 | ||
14599 | memcpy(tp->fw_ver, &vpd_data[j], len); | 14607 | if (len >= sizeof(tp->fw_ver)) |
14600 | strncat(tp->fw_ver, " bc ", vpdlen - len - 1); | 14608 | len = sizeof(tp->fw_ver) - 1; |
14609 | memset(tp->fw_ver, 0, sizeof(tp->fw_ver)); | ||
14610 | snprintf(tp->fw_ver, sizeof(tp->fw_ver), "%.*s bc ", len, | ||
14611 | &vpd_data[j]); | ||
14601 | } | 14612 | } |
14602 | 14613 | ||
14603 | partno: | 14614 | partno: |
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index a170065b5973..b0ebc9f6d55e 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -163,6 +163,7 @@ | |||
163 | #define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ | 163 | #define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ |
164 | 164 | ||
165 | /* XGMAC_INT_STAT reg */ | 165 | /* XGMAC_INT_STAT reg */ |
166 | #define XGMAC_INT_STAT_PMTIM 0x00800000 /* PMT Interrupt Mask */ | ||
166 | #define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ | 167 | #define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ |
167 | #define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ | 168 | #define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ |
168 | 169 | ||
@@ -960,6 +961,9 @@ static int xgmac_hw_init(struct net_device *dev) | |||
960 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); | 961 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); |
961 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); | 962 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); |
962 | 963 | ||
964 | /* Mask power mgt interrupt */ | ||
965 | writel(XGMAC_INT_STAT_PMTIM, ioaddr + XGMAC_INT_STAT); | ||
966 | |||
963 | /* XGMAC requires AXI bus init. This is a 'magic number' for now */ | 967 | /* XGMAC requires AXI bus init. This is a 'magic number' for now */ |
964 | writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); | 968 | writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); |
965 | 969 | ||
@@ -1141,6 +1145,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit) | |||
1141 | struct sk_buff *skb; | 1145 | struct sk_buff *skb; |
1142 | int frame_len; | 1146 | int frame_len; |
1143 | 1147 | ||
1148 | if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ)) | ||
1149 | break; | ||
1150 | |||
1144 | entry = priv->rx_tail; | 1151 | entry = priv->rx_tail; |
1145 | p = priv->dma_rx + entry; | 1152 | p = priv->dma_rx + entry; |
1146 | if (desc_get_owner(p)) | 1153 | if (desc_get_owner(p)) |
@@ -1825,7 +1832,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode) | |||
1825 | unsigned int pmt = 0; | 1832 | unsigned int pmt = 0; |
1826 | 1833 | ||
1827 | if (mode & WAKE_MAGIC) | 1834 | if (mode & WAKE_MAGIC) |
1828 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT; | 1835 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT_EN; |
1829 | if (mode & WAKE_UCAST) | 1836 | if (mode & WAKE_UCAST) |
1830 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; | 1837 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; |
1831 | 1838 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4ce62031f62f..8049268ce0f2 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -497,8 +497,9 @@ int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len, | |||
497 | } | 497 | } |
498 | 498 | ||
499 | #define EEPROM_STAT_ADDR 0x7bfc | 499 | #define EEPROM_STAT_ADDR 0x7bfc |
500 | #define VPD_BASE 0 | ||
501 | #define VPD_LEN 512 | 500 | #define VPD_LEN 512 |
501 | #define VPD_BASE 0x400 | ||
502 | #define VPD_BASE_OLD 0 | ||
502 | 503 | ||
503 | /** | 504 | /** |
504 | * t4_seeprom_wp - enable/disable EEPROM write protection | 505 | * t4_seeprom_wp - enable/disable EEPROM write protection |
@@ -524,7 +525,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) | |||
524 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | 525 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p) |
525 | { | 526 | { |
526 | u32 cclk_param, cclk_val; | 527 | u32 cclk_param, cclk_val; |
527 | int i, ret; | 528 | int i, ret, addr; |
528 | int ec, sn; | 529 | int ec, sn; |
529 | u8 *vpd, csum; | 530 | u8 *vpd, csum; |
530 | unsigned int vpdr_len, kw_offset, id_len; | 531 | unsigned int vpdr_len, kw_offset, id_len; |
@@ -533,7 +534,12 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
533 | if (!vpd) | 534 | if (!vpd) |
534 | return -ENOMEM; | 535 | return -ENOMEM; |
535 | 536 | ||
536 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, VPD_LEN, vpd); | 537 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); |
538 | if (ret < 0) | ||
539 | goto out; | ||
540 | addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; | ||
541 | |||
542 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); | ||
537 | if (ret < 0) | 543 | if (ret < 0) |
538 | goto out; | 544 | goto out; |
539 | 545 | ||
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 8cdf02503d13..9eada8e86078 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -257,6 +257,107 @@ static void dm9000_dumpblk_32bit(void __iomem *reg, int count) | |||
257 | tmp = readl(reg); | 257 | tmp = readl(reg); |
258 | } | 258 | } |
259 | 259 | ||
260 | /* | ||
261 | * Sleep, either by using msleep() or if we are suspending, then | ||
262 | * use mdelay() to sleep. | ||
263 | */ | ||
264 | static void dm9000_msleep(board_info_t *db, unsigned int ms) | ||
265 | { | ||
266 | if (db->in_suspend) | ||
267 | mdelay(ms); | ||
268 | else | ||
269 | msleep(ms); | ||
270 | } | ||
271 | |||
272 | /* Read a word from phyxcer */ | ||
273 | static int | ||
274 | dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg) | ||
275 | { | ||
276 | board_info_t *db = netdev_priv(dev); | ||
277 | unsigned long flags; | ||
278 | unsigned int reg_save; | ||
279 | int ret; | ||
280 | |||
281 | mutex_lock(&db->addr_lock); | ||
282 | |||
283 | spin_lock_irqsave(&db->lock, flags); | ||
284 | |||
285 | /* Save previous register address */ | ||
286 | reg_save = readb(db->io_addr); | ||
287 | |||
288 | /* Fill the phyxcer register into REG_0C */ | ||
289 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
290 | |||
291 | /* Issue phyxcer read command */ | ||
292 | iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); | ||
293 | |||
294 | writeb(reg_save, db->io_addr); | ||
295 | spin_unlock_irqrestore(&db->lock, flags); | ||
296 | |||
297 | dm9000_msleep(db, 1); /* Wait read complete */ | ||
298 | |||
299 | spin_lock_irqsave(&db->lock, flags); | ||
300 | reg_save = readb(db->io_addr); | ||
301 | |||
302 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ | ||
303 | |||
304 | /* The read data keeps on REG_0D & REG_0E */ | ||
305 | ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); | ||
306 | |||
307 | /* restore the previous address */ | ||
308 | writeb(reg_save, db->io_addr); | ||
309 | spin_unlock_irqrestore(&db->lock, flags); | ||
310 | |||
311 | mutex_unlock(&db->addr_lock); | ||
312 | |||
313 | dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); | ||
314 | return ret; | ||
315 | } | ||
316 | |||
317 | /* Write a word to phyxcer */ | ||
318 | static void | ||
319 | dm9000_phy_write(struct net_device *dev, | ||
320 | int phyaddr_unused, int reg, int value) | ||
321 | { | ||
322 | board_info_t *db = netdev_priv(dev); | ||
323 | unsigned long flags; | ||
324 | unsigned long reg_save; | ||
325 | |||
326 | dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); | ||
327 | mutex_lock(&db->addr_lock); | ||
328 | |||
329 | spin_lock_irqsave(&db->lock, flags); | ||
330 | |||
331 | /* Save previous register address */ | ||
332 | reg_save = readb(db->io_addr); | ||
333 | |||
334 | /* Fill the phyxcer register into REG_0C */ | ||
335 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
336 | |||
337 | /* Fill the written data into REG_0D & REG_0E */ | ||
338 | iow(db, DM9000_EPDRL, value); | ||
339 | iow(db, DM9000_EPDRH, value >> 8); | ||
340 | |||
341 | /* Issue phyxcer write command */ | ||
342 | iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); | ||
343 | |||
344 | writeb(reg_save, db->io_addr); | ||
345 | spin_unlock_irqrestore(&db->lock, flags); | ||
346 | |||
347 | dm9000_msleep(db, 1); /* Wait write complete */ | ||
348 | |||
349 | spin_lock_irqsave(&db->lock, flags); | ||
350 | reg_save = readb(db->io_addr); | ||
351 | |||
352 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ | ||
353 | |||
354 | /* restore the previous address */ | ||
355 | writeb(reg_save, db->io_addr); | ||
356 | |||
357 | spin_unlock_irqrestore(&db->lock, flags); | ||
358 | mutex_unlock(&db->addr_lock); | ||
359 | } | ||
360 | |||
260 | /* dm9000_set_io | 361 | /* dm9000_set_io |
261 | * | 362 | * |
262 | * select the specified set of io routines to use with the | 363 | * select the specified set of io routines to use with the |
@@ -795,6 +896,9 @@ dm9000_init_dm9000(struct net_device *dev) | |||
795 | 896 | ||
796 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ | 897 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ |
797 | 898 | ||
899 | dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */ | ||
900 | dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */ | ||
901 | |||
798 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; | 902 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; |
799 | 903 | ||
800 | /* if wol is needed, then always set NCR_WAKEEN otherwise we end | 904 | /* if wol is needed, then always set NCR_WAKEEN otherwise we end |
@@ -1201,109 +1305,6 @@ dm9000_open(struct net_device *dev) | |||
1201 | return 0; | 1305 | return 0; |
1202 | } | 1306 | } |
1203 | 1307 | ||
1204 | /* | ||
1205 | * Sleep, either by using msleep() or if we are suspending, then | ||
1206 | * use mdelay() to sleep. | ||
1207 | */ | ||
1208 | static void dm9000_msleep(board_info_t *db, unsigned int ms) | ||
1209 | { | ||
1210 | if (db->in_suspend) | ||
1211 | mdelay(ms); | ||
1212 | else | ||
1213 | msleep(ms); | ||
1214 | } | ||
1215 | |||
1216 | /* | ||
1217 | * Read a word from phyxcer | ||
1218 | */ | ||
1219 | static int | ||
1220 | dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg) | ||
1221 | { | ||
1222 | board_info_t *db = netdev_priv(dev); | ||
1223 | unsigned long flags; | ||
1224 | unsigned int reg_save; | ||
1225 | int ret; | ||
1226 | |||
1227 | mutex_lock(&db->addr_lock); | ||
1228 | |||
1229 | spin_lock_irqsave(&db->lock,flags); | ||
1230 | |||
1231 | /* Save previous register address */ | ||
1232 | reg_save = readb(db->io_addr); | ||
1233 | |||
1234 | /* Fill the phyxcer register into REG_0C */ | ||
1235 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
1236 | |||
1237 | iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); /* Issue phyxcer read command */ | ||
1238 | |||
1239 | writeb(reg_save, db->io_addr); | ||
1240 | spin_unlock_irqrestore(&db->lock,flags); | ||
1241 | |||
1242 | dm9000_msleep(db, 1); /* Wait read complete */ | ||
1243 | |||
1244 | spin_lock_irqsave(&db->lock,flags); | ||
1245 | reg_save = readb(db->io_addr); | ||
1246 | |||
1247 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ | ||
1248 | |||
1249 | /* The read data keeps on REG_0D & REG_0E */ | ||
1250 | ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); | ||
1251 | |||
1252 | /* restore the previous address */ | ||
1253 | writeb(reg_save, db->io_addr); | ||
1254 | spin_unlock_irqrestore(&db->lock,flags); | ||
1255 | |||
1256 | mutex_unlock(&db->addr_lock); | ||
1257 | |||
1258 | dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); | ||
1259 | return ret; | ||
1260 | } | ||
1261 | |||
1262 | /* | ||
1263 | * Write a word to phyxcer | ||
1264 | */ | ||
1265 | static void | ||
1266 | dm9000_phy_write(struct net_device *dev, | ||
1267 | int phyaddr_unused, int reg, int value) | ||
1268 | { | ||
1269 | board_info_t *db = netdev_priv(dev); | ||
1270 | unsigned long flags; | ||
1271 | unsigned long reg_save; | ||
1272 | |||
1273 | dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); | ||
1274 | mutex_lock(&db->addr_lock); | ||
1275 | |||
1276 | spin_lock_irqsave(&db->lock,flags); | ||
1277 | |||
1278 | /* Save previous register address */ | ||
1279 | reg_save = readb(db->io_addr); | ||
1280 | |||
1281 | /* Fill the phyxcer register into REG_0C */ | ||
1282 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
1283 | |||
1284 | /* Fill the written data into REG_0D & REG_0E */ | ||
1285 | iow(db, DM9000_EPDRL, value); | ||
1286 | iow(db, DM9000_EPDRH, value >> 8); | ||
1287 | |||
1288 | iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); /* Issue phyxcer write command */ | ||
1289 | |||
1290 | writeb(reg_save, db->io_addr); | ||
1291 | spin_unlock_irqrestore(&db->lock, flags); | ||
1292 | |||
1293 | dm9000_msleep(db, 1); /* Wait write complete */ | ||
1294 | |||
1295 | spin_lock_irqsave(&db->lock,flags); | ||
1296 | reg_save = readb(db->io_addr); | ||
1297 | |||
1298 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ | ||
1299 | |||
1300 | /* restore the previous address */ | ||
1301 | writeb(reg_save, db->io_addr); | ||
1302 | |||
1303 | spin_unlock_irqrestore(&db->lock, flags); | ||
1304 | mutex_unlock(&db->addr_lock); | ||
1305 | } | ||
1306 | |||
1307 | static void | 1308 | static void |
1308 | dm9000_shutdown(struct net_device *dev) | 1309 | dm9000_shutdown(struct net_device *dev) |
1309 | { | 1310 | { |
@@ -1502,7 +1503,12 @@ dm9000_probe(struct platform_device *pdev) | |||
1502 | db->flags |= DM9000_PLATF_SIMPLE_PHY; | 1503 | db->flags |= DM9000_PLATF_SIMPLE_PHY; |
1503 | #endif | 1504 | #endif |
1504 | 1505 | ||
1505 | dm9000_reset(db); | 1506 | /* Fixing bug on dm9000_probe, takeover dm9000_reset(db), |
1507 | * Need 'NCR_MAC_LBK' bit to indeed stable our DM9000 fifo | ||
1508 | * while probe stage. | ||
1509 | */ | ||
1510 | |||
1511 | iow(db, DM9000_NCR, NCR_MAC_LBK | NCR_RST); | ||
1506 | 1512 | ||
1507 | /* try multiple times, DM9000 sometimes gets the read wrong */ | 1513 | /* try multiple times, DM9000 sometimes gets the read wrong */ |
1508 | for (i = 0; i < 8; i++) { | 1514 | for (i = 0; i < 8; i++) { |
diff --git a/drivers/net/ethernet/davicom/dm9000.h b/drivers/net/ethernet/davicom/dm9000.h index 55688bd1a3ef..9ce058adabab 100644 --- a/drivers/net/ethernet/davicom/dm9000.h +++ b/drivers/net/ethernet/davicom/dm9000.h | |||
@@ -69,7 +69,9 @@ | |||
69 | #define NCR_WAKEEN (1<<6) | 69 | #define NCR_WAKEEN (1<<6) |
70 | #define NCR_FCOL (1<<4) | 70 | #define NCR_FCOL (1<<4) |
71 | #define NCR_FDX (1<<3) | 71 | #define NCR_FDX (1<<3) |
72 | #define NCR_LBK (3<<1) | 72 | |
73 | #define NCR_RESERVED (3<<1) | ||
74 | #define NCR_MAC_LBK (1<<1) | ||
73 | #define NCR_RST (1<<0) | 75 | #define NCR_RST (1<<0) |
74 | 76 | ||
75 | #define NSR_SPEED (1<<7) | 77 | #define NSR_SPEED (1<<7) |
@@ -167,5 +169,12 @@ | |||
167 | #define ISR_LNKCHNG (1<<5) | 169 | #define ISR_LNKCHNG (1<<5) |
168 | #define ISR_UNDERRUN (1<<4) | 170 | #define ISR_UNDERRUN (1<<4) |
169 | 171 | ||
172 | /* Davicom MII registers. | ||
173 | */ | ||
174 | |||
175 | #define MII_DM_DSPCR 0x1b /* DSP Control Register */ | ||
176 | |||
177 | #define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */ | ||
178 | |||
170 | #endif /* _DM9000X_H_ */ | 179 | #endif /* _DM9000X_H_ */ |
171 | 180 | ||
diff --git a/drivers/net/ethernet/dec/tulip/Kconfig b/drivers/net/ethernet/dec/tulip/Kconfig index 0c37fb2cc867..1df33c799c00 100644 --- a/drivers/net/ethernet/dec/tulip/Kconfig +++ b/drivers/net/ethernet/dec/tulip/Kconfig | |||
@@ -108,6 +108,7 @@ config TULIP_DM910X | |||
108 | config DE4X5 | 108 | config DE4X5 |
109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" | 109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" |
110 | depends on (PCI || EISA) | 110 | depends on (PCI || EISA) |
111 | depends on VIRT_TO_BUS || ALPHA || PPC || SPARC | ||
111 | select CRC32 | 112 | select CRC32 |
112 | ---help--- | 113 | ---help--- |
113 | This is support for the DIGITAL series of PCI/EISA Ethernet cards. | 114 | This is support for the DIGITAL series of PCI/EISA Ethernet cards. |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 08e54f3d288b..2886c9b63f90 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -759,8 +759,9 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, | |||
759 | 759 | ||
760 | if (vlan_tx_tag_present(skb)) { | 760 | if (vlan_tx_tag_present(skb)) { |
761 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 761 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
762 | __vlan_put_tag(skb, vlan_tag); | 762 | skb = __vlan_put_tag(skb, vlan_tag); |
763 | skb->vlan_tci = 0; | 763 | if (skb) |
764 | skb->vlan_tci = 0; | ||
764 | } | 765 | } |
765 | 766 | ||
766 | return skb; | 767 | return skb; |
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 069a155d16ed..73195f643c9c 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -345,6 +345,53 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
345 | return NETDEV_TX_OK; | 345 | return NETDEV_TX_OK; |
346 | } | 346 | } |
347 | 347 | ||
348 | /* Init RX & TX buffer descriptors | ||
349 | */ | ||
350 | static void fec_enet_bd_init(struct net_device *dev) | ||
351 | { | ||
352 | struct fec_enet_private *fep = netdev_priv(dev); | ||
353 | struct bufdesc *bdp; | ||
354 | unsigned int i; | ||
355 | |||
356 | /* Initialize the receive buffer descriptors. */ | ||
357 | bdp = fep->rx_bd_base; | ||
358 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
359 | |||
360 | /* Initialize the BD for every fragment in the page. */ | ||
361 | if (bdp->cbd_bufaddr) | ||
362 | bdp->cbd_sc = BD_ENET_RX_EMPTY; | ||
363 | else | ||
364 | bdp->cbd_sc = 0; | ||
365 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
366 | } | ||
367 | |||
368 | /* Set the last buffer to wrap */ | ||
369 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
370 | bdp->cbd_sc |= BD_SC_WRAP; | ||
371 | |||
372 | fep->cur_rx = fep->rx_bd_base; | ||
373 | |||
374 | /* ...and the same for transmit */ | ||
375 | bdp = fep->tx_bd_base; | ||
376 | fep->cur_tx = bdp; | ||
377 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
378 | |||
379 | /* Initialize the BD for every fragment in the page. */ | ||
380 | bdp->cbd_sc = 0; | ||
381 | if (bdp->cbd_bufaddr && fep->tx_skbuff[i]) { | ||
382 | dev_kfree_skb_any(fep->tx_skbuff[i]); | ||
383 | fep->tx_skbuff[i] = NULL; | ||
384 | } | ||
385 | bdp->cbd_bufaddr = 0; | ||
386 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
387 | } | ||
388 | |||
389 | /* Set the last buffer to wrap */ | ||
390 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
391 | bdp->cbd_sc |= BD_SC_WRAP; | ||
392 | fep->dirty_tx = bdp; | ||
393 | } | ||
394 | |||
348 | /* This function is called to start or restart the FEC during a link | 395 | /* This function is called to start or restart the FEC during a link |
349 | * change. This only happens when switching between half and full | 396 | * change. This only happens when switching between half and full |
350 | * duplex. | 397 | * duplex. |
@@ -388,6 +435,8 @@ fec_restart(struct net_device *ndev, int duplex) | |||
388 | /* Set maximum receive buffer size. */ | 435 | /* Set maximum receive buffer size. */ |
389 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); | 436 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); |
390 | 437 | ||
438 | fec_enet_bd_init(ndev); | ||
439 | |||
391 | /* Set receive and transmit descriptor base. */ | 440 | /* Set receive and transmit descriptor base. */ |
392 | writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); | 441 | writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); |
393 | if (fep->bufdesc_ex) | 442 | if (fep->bufdesc_ex) |
@@ -397,7 +446,6 @@ fec_restart(struct net_device *ndev, int duplex) | |||
397 | writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) | 446 | writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) |
398 | * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); | 447 | * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); |
399 | 448 | ||
400 | fep->cur_rx = fep->rx_bd_base; | ||
401 | 449 | ||
402 | for (i = 0; i <= TX_RING_MOD_MASK; i++) { | 450 | for (i = 0; i <= TX_RING_MOD_MASK; i++) { |
403 | if (fep->tx_skbuff[i]) { | 451 | if (fep->tx_skbuff[i]) { |
@@ -934,24 +982,29 @@ static void fec_enet_adjust_link(struct net_device *ndev) | |||
934 | goto spin_unlock; | 982 | goto spin_unlock; |
935 | } | 983 | } |
936 | 984 | ||
937 | /* Duplex link change */ | ||
938 | if (phy_dev->link) { | 985 | if (phy_dev->link) { |
939 | if (fep->full_duplex != phy_dev->duplex) { | 986 | if (!fep->link) { |
940 | fec_restart(ndev, phy_dev->duplex); | ||
941 | /* prevent unnecessary second fec_restart() below */ | ||
942 | fep->link = phy_dev->link; | 987 | fep->link = phy_dev->link; |
943 | status_change = 1; | 988 | status_change = 1; |
944 | } | 989 | } |
945 | } | ||
946 | 990 | ||
947 | /* Link on or off change */ | 991 | if (fep->full_duplex != phy_dev->duplex) |
948 | if (phy_dev->link != fep->link) { | 992 | status_change = 1; |
949 | fep->link = phy_dev->link; | 993 | |
950 | if (phy_dev->link) | 994 | if (phy_dev->speed != fep->speed) { |
995 | fep->speed = phy_dev->speed; | ||
996 | status_change = 1; | ||
997 | } | ||
998 | |||
999 | /* if any of the above changed restart the FEC */ | ||
1000 | if (status_change) | ||
951 | fec_restart(ndev, phy_dev->duplex); | 1001 | fec_restart(ndev, phy_dev->duplex); |
952 | else | 1002 | } else { |
1003 | if (fep->link) { | ||
953 | fec_stop(ndev); | 1004 | fec_stop(ndev); |
954 | status_change = 1; | 1005 | fep->link = phy_dev->link; |
1006 | status_change = 1; | ||
1007 | } | ||
955 | } | 1008 | } |
956 | 1009 | ||
957 | spin_unlock: | 1010 | spin_unlock: |
@@ -1328,7 +1381,7 @@ static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | |||
1328 | static void fec_enet_free_buffers(struct net_device *ndev) | 1381 | static void fec_enet_free_buffers(struct net_device *ndev) |
1329 | { | 1382 | { |
1330 | struct fec_enet_private *fep = netdev_priv(ndev); | 1383 | struct fec_enet_private *fep = netdev_priv(ndev); |
1331 | int i; | 1384 | unsigned int i; |
1332 | struct sk_buff *skb; | 1385 | struct sk_buff *skb; |
1333 | struct bufdesc *bdp; | 1386 | struct bufdesc *bdp; |
1334 | 1387 | ||
@@ -1352,7 +1405,7 @@ static void fec_enet_free_buffers(struct net_device *ndev) | |||
1352 | static int fec_enet_alloc_buffers(struct net_device *ndev) | 1405 | static int fec_enet_alloc_buffers(struct net_device *ndev) |
1353 | { | 1406 | { |
1354 | struct fec_enet_private *fep = netdev_priv(ndev); | 1407 | struct fec_enet_private *fep = netdev_priv(ndev); |
1355 | int i; | 1408 | unsigned int i; |
1356 | struct sk_buff *skb; | 1409 | struct sk_buff *skb; |
1357 | struct bufdesc *bdp; | 1410 | struct bufdesc *bdp; |
1358 | 1411 | ||
@@ -1437,6 +1490,7 @@ fec_enet_close(struct net_device *ndev) | |||
1437 | struct fec_enet_private *fep = netdev_priv(ndev); | 1490 | struct fec_enet_private *fep = netdev_priv(ndev); |
1438 | 1491 | ||
1439 | /* Don't know what to do yet. */ | 1492 | /* Don't know what to do yet. */ |
1493 | napi_disable(&fep->napi); | ||
1440 | fep->opened = 0; | 1494 | fep->opened = 0; |
1441 | netif_stop_queue(ndev); | 1495 | netif_stop_queue(ndev); |
1442 | fec_stop(ndev); | 1496 | fec_stop(ndev); |
@@ -1592,8 +1646,6 @@ static int fec_enet_init(struct net_device *ndev) | |||
1592 | { | 1646 | { |
1593 | struct fec_enet_private *fep = netdev_priv(ndev); | 1647 | struct fec_enet_private *fep = netdev_priv(ndev); |
1594 | struct bufdesc *cbd_base; | 1648 | struct bufdesc *cbd_base; |
1595 | struct bufdesc *bdp; | ||
1596 | int i; | ||
1597 | 1649 | ||
1598 | /* Allocate memory for buffer descriptors. */ | 1650 | /* Allocate memory for buffer descriptors. */ |
1599 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, | 1651 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, |
@@ -1603,6 +1655,7 @@ static int fec_enet_init(struct net_device *ndev) | |||
1603 | return -ENOMEM; | 1655 | return -ENOMEM; |
1604 | } | 1656 | } |
1605 | 1657 | ||
1658 | memset(cbd_base, 0, PAGE_SIZE); | ||
1606 | spin_lock_init(&fep->hw_lock); | 1659 | spin_lock_init(&fep->hw_lock); |
1607 | 1660 | ||
1608 | fep->netdev = ndev; | 1661 | fep->netdev = ndev; |
@@ -1626,35 +1679,6 @@ static int fec_enet_init(struct net_device *ndev) | |||
1626 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); | 1679 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); |
1627 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); | 1680 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); |
1628 | 1681 | ||
1629 | /* Initialize the receive buffer descriptors. */ | ||
1630 | bdp = fep->rx_bd_base; | ||
1631 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
1632 | |||
1633 | /* Initialize the BD for every fragment in the page. */ | ||
1634 | bdp->cbd_sc = 0; | ||
1635 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
1636 | } | ||
1637 | |||
1638 | /* Set the last buffer to wrap */ | ||
1639 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
1640 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1641 | |||
1642 | /* ...and the same for transmit */ | ||
1643 | bdp = fep->tx_bd_base; | ||
1644 | fep->cur_tx = bdp; | ||
1645 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1646 | |||
1647 | /* Initialize the BD for every fragment in the page. */ | ||
1648 | bdp->cbd_sc = 0; | ||
1649 | bdp->cbd_bufaddr = 0; | ||
1650 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
1651 | } | ||
1652 | |||
1653 | /* Set the last buffer to wrap */ | ||
1654 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
1655 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1656 | fep->dirty_tx = bdp; | ||
1657 | |||
1658 | fec_restart(ndev, 0); | 1682 | fec_restart(ndev, 0); |
1659 | 1683 | ||
1660 | return 0; | 1684 | return 0; |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index f5390071efd0..eb4372962839 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -240,6 +240,7 @@ struct fec_enet_private { | |||
240 | phy_interface_t phy_interface; | 240 | phy_interface_t phy_interface; |
241 | int link; | 241 | int link; |
242 | int full_duplex; | 242 | int full_duplex; |
243 | int speed; | ||
243 | struct completion mdio_done; | 244 | struct completion mdio_done; |
244 | int irq[FEC_IRQ_NUM]; | 245 | int irq[FEC_IRQ_NUM]; |
245 | int bufdesc_ex; | 246 | int bufdesc_ex; |
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 1f17ca0f2201..0d8df400a479 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c | |||
@@ -128,6 +128,7 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev) | |||
128 | 128 | ||
129 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); | 129 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); |
130 | } | 130 | } |
131 | EXPORT_SYMBOL(fec_ptp_start_cyclecounter); | ||
131 | 132 | ||
132 | /** | 133 | /** |
133 | * fec_ptp_adjfreq - adjust ptp cycle frequency | 134 | * fec_ptp_adjfreq - adjust ptp cycle frequency |
@@ -318,6 +319,7 @@ int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
318 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? | 319 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? |
319 | -EFAULT : 0; | 320 | -EFAULT : 0; |
320 | } | 321 | } |
322 | EXPORT_SYMBOL(fec_ptp_ioctl); | ||
321 | 323 | ||
322 | /** | 324 | /** |
323 | * fec_time_keep - call timecounter_read every second to avoid timer overrun | 325 | * fec_time_keep - call timecounter_read every second to avoid timer overrun |
@@ -383,3 +385,4 @@ void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev) | |||
383 | pr_info("registered PHC device on %s\n", ndev->name); | 385 | pr_info("registered PHC device on %s\n", ndev->name); |
384 | } | 386 | } |
385 | } | 387 | } |
388 | EXPORT_SYMBOL(fec_ptp_init); | ||
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index ec800b093e7e..d2bea3f07c73 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c | |||
@@ -870,7 +870,7 @@ err_unlock: | |||
870 | } | 870 | } |
871 | 871 | ||
872 | static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, | 872 | static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, |
873 | void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) | 873 | int (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) |
874 | { | 874 | { |
875 | struct cb *cb; | 875 | struct cb *cb; |
876 | unsigned long flags; | 876 | unsigned long flags; |
@@ -888,10 +888,13 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, | |||
888 | nic->cbs_avail--; | 888 | nic->cbs_avail--; |
889 | cb->skb = skb; | 889 | cb->skb = skb; |
890 | 890 | ||
891 | err = cb_prepare(nic, cb, skb); | ||
892 | if (err) | ||
893 | goto err_unlock; | ||
894 | |||
891 | if (unlikely(!nic->cbs_avail)) | 895 | if (unlikely(!nic->cbs_avail)) |
892 | err = -ENOSPC; | 896 | err = -ENOSPC; |
893 | 897 | ||
894 | cb_prepare(nic, cb, skb); | ||
895 | 898 | ||
896 | /* Order is important otherwise we'll be in a race with h/w: | 899 | /* Order is important otherwise we'll be in a race with h/w: |
897 | * set S-bit in current first, then clear S-bit in previous. */ | 900 | * set S-bit in current first, then clear S-bit in previous. */ |
@@ -1091,7 +1094,7 @@ static void e100_get_defaults(struct nic *nic) | |||
1091 | nic->mii.mdio_write = mdio_write; | 1094 | nic->mii.mdio_write = mdio_write; |
1092 | } | 1095 | } |
1093 | 1096 | ||
1094 | static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1097 | static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1095 | { | 1098 | { |
1096 | struct config *config = &cb->u.config; | 1099 | struct config *config = &cb->u.config; |
1097 | u8 *c = (u8 *)config; | 1100 | u8 *c = (u8 *)config; |
@@ -1181,6 +1184,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1181 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, | 1184 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, |
1182 | "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", | 1185 | "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", |
1183 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); | 1186 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); |
1187 | return 0; | ||
1184 | } | 1188 | } |
1185 | 1189 | ||
1186 | /************************************************************************* | 1190 | /************************************************************************* |
@@ -1331,7 +1335,7 @@ static const struct firmware *e100_request_firmware(struct nic *nic) | |||
1331 | return fw; | 1335 | return fw; |
1332 | } | 1336 | } |
1333 | 1337 | ||
1334 | static void e100_setup_ucode(struct nic *nic, struct cb *cb, | 1338 | static int e100_setup_ucode(struct nic *nic, struct cb *cb, |
1335 | struct sk_buff *skb) | 1339 | struct sk_buff *skb) |
1336 | { | 1340 | { |
1337 | const struct firmware *fw = (void *)skb; | 1341 | const struct firmware *fw = (void *)skb; |
@@ -1358,6 +1362,7 @@ static void e100_setup_ucode(struct nic *nic, struct cb *cb, | |||
1358 | cb->u.ucode[min_size] |= cpu_to_le32((BUNDLESMALL) ? 0xFFFF : 0xFF80); | 1362 | cb->u.ucode[min_size] |= cpu_to_le32((BUNDLESMALL) ? 0xFFFF : 0xFF80); |
1359 | 1363 | ||
1360 | cb->command = cpu_to_le16(cb_ucode | cb_el); | 1364 | cb->command = cpu_to_le16(cb_ucode | cb_el); |
1365 | return 0; | ||
1361 | } | 1366 | } |
1362 | 1367 | ||
1363 | static inline int e100_load_ucode_wait(struct nic *nic) | 1368 | static inline int e100_load_ucode_wait(struct nic *nic) |
@@ -1400,18 +1405,20 @@ static inline int e100_load_ucode_wait(struct nic *nic) | |||
1400 | return err; | 1405 | return err; |
1401 | } | 1406 | } |
1402 | 1407 | ||
1403 | static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, | 1408 | static int e100_setup_iaaddr(struct nic *nic, struct cb *cb, |
1404 | struct sk_buff *skb) | 1409 | struct sk_buff *skb) |
1405 | { | 1410 | { |
1406 | cb->command = cpu_to_le16(cb_iaaddr); | 1411 | cb->command = cpu_to_le16(cb_iaaddr); |
1407 | memcpy(cb->u.iaaddr, nic->netdev->dev_addr, ETH_ALEN); | 1412 | memcpy(cb->u.iaaddr, nic->netdev->dev_addr, ETH_ALEN); |
1413 | return 0; | ||
1408 | } | 1414 | } |
1409 | 1415 | ||
1410 | static void e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1416 | static int e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1411 | { | 1417 | { |
1412 | cb->command = cpu_to_le16(cb_dump); | 1418 | cb->command = cpu_to_le16(cb_dump); |
1413 | cb->u.dump_buffer_addr = cpu_to_le32(nic->dma_addr + | 1419 | cb->u.dump_buffer_addr = cpu_to_le32(nic->dma_addr + |
1414 | offsetof(struct mem, dump_buf)); | 1420 | offsetof(struct mem, dump_buf)); |
1421 | return 0; | ||
1415 | } | 1422 | } |
1416 | 1423 | ||
1417 | static int e100_phy_check_without_mii(struct nic *nic) | 1424 | static int e100_phy_check_without_mii(struct nic *nic) |
@@ -1581,7 +1588,7 @@ static int e100_hw_init(struct nic *nic) | |||
1581 | return 0; | 1588 | return 0; |
1582 | } | 1589 | } |
1583 | 1590 | ||
1584 | static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1591 | static int e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1585 | { | 1592 | { |
1586 | struct net_device *netdev = nic->netdev; | 1593 | struct net_device *netdev = nic->netdev; |
1587 | struct netdev_hw_addr *ha; | 1594 | struct netdev_hw_addr *ha; |
@@ -1596,6 +1603,7 @@ static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1596 | memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr, | 1603 | memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr, |
1597 | ETH_ALEN); | 1604 | ETH_ALEN); |
1598 | } | 1605 | } |
1606 | return 0; | ||
1599 | } | 1607 | } |
1600 | 1608 | ||
1601 | static void e100_set_multicast_list(struct net_device *netdev) | 1609 | static void e100_set_multicast_list(struct net_device *netdev) |
@@ -1756,11 +1764,18 @@ static void e100_watchdog(unsigned long data) | |||
1756 | round_jiffies(jiffies + E100_WATCHDOG_PERIOD)); | 1764 | round_jiffies(jiffies + E100_WATCHDOG_PERIOD)); |
1757 | } | 1765 | } |
1758 | 1766 | ||
1759 | static void e100_xmit_prepare(struct nic *nic, struct cb *cb, | 1767 | static int e100_xmit_prepare(struct nic *nic, struct cb *cb, |
1760 | struct sk_buff *skb) | 1768 | struct sk_buff *skb) |
1761 | { | 1769 | { |
1770 | dma_addr_t dma_addr; | ||
1762 | cb->command = nic->tx_command; | 1771 | cb->command = nic->tx_command; |
1763 | 1772 | ||
1773 | dma_addr = pci_map_single(nic->pdev, | ||
1774 | skb->data, skb->len, PCI_DMA_TODEVICE); | ||
1775 | /* If we can't map the skb, have the upper layer try later */ | ||
1776 | if (pci_dma_mapping_error(nic->pdev, dma_addr)) | ||
1777 | return -ENOMEM; | ||
1778 | |||
1764 | /* | 1779 | /* |
1765 | * Use the last 4 bytes of the SKB payload packet as the CRC, used for | 1780 | * Use the last 4 bytes of the SKB payload packet as the CRC, used for |
1766 | * testing, ie sending frames with bad CRC. | 1781 | * testing, ie sending frames with bad CRC. |
@@ -1777,11 +1792,10 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb, | |||
1777 | cb->u.tcb.tcb_byte_count = 0; | 1792 | cb->u.tcb.tcb_byte_count = 0; |
1778 | cb->u.tcb.threshold = nic->tx_threshold; | 1793 | cb->u.tcb.threshold = nic->tx_threshold; |
1779 | cb->u.tcb.tbd_count = 1; | 1794 | cb->u.tcb.tbd_count = 1; |
1780 | cb->u.tcb.tbd.buf_addr = cpu_to_le32(pci_map_single(nic->pdev, | 1795 | cb->u.tcb.tbd.buf_addr = cpu_to_le32(dma_addr); |
1781 | skb->data, skb->len, PCI_DMA_TODEVICE)); | ||
1782 | /* check for mapping failure? */ | ||
1783 | cb->u.tcb.tbd.size = cpu_to_le16(skb->len); | 1796 | cb->u.tcb.tbd.size = cpu_to_le16(skb->len); |
1784 | skb_tx_timestamp(skb); | 1797 | skb_tx_timestamp(skb); |
1798 | return 0; | ||
1785 | } | 1799 | } |
1786 | 1800 | ||
1787 | static netdev_tx_t e100_xmit_frame(struct sk_buff *skb, | 1801 | static netdev_tx_t e100_xmit_frame(struct sk_buff *skb, |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index 43462d596a4e..ffd287196bf8 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c | |||
@@ -1053,6 +1053,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1053 | txdr->buffer_info[i].dma = | 1053 | txdr->buffer_info[i].dma = |
1054 | dma_map_single(&pdev->dev, skb->data, skb->len, | 1054 | dma_map_single(&pdev->dev, skb->data, skb->len, |
1055 | DMA_TO_DEVICE); | 1055 | DMA_TO_DEVICE); |
1056 | if (dma_mapping_error(&pdev->dev, txdr->buffer_info[i].dma)) { | ||
1057 | ret_val = 4; | ||
1058 | goto err_nomem; | ||
1059 | } | ||
1056 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); | 1060 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); |
1057 | tx_desc->lower.data = cpu_to_le32(skb->len); | 1061 | tx_desc->lower.data = cpu_to_le32(skb->len); |
1058 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | | 1062 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | |
@@ -1069,7 +1073,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1069 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), | 1073 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), |
1070 | GFP_KERNEL); | 1074 | GFP_KERNEL); |
1071 | if (!rxdr->buffer_info) { | 1075 | if (!rxdr->buffer_info) { |
1072 | ret_val = 4; | 1076 | ret_val = 5; |
1073 | goto err_nomem; | 1077 | goto err_nomem; |
1074 | } | 1078 | } |
1075 | 1079 | ||
@@ -1077,7 +1081,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1077 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, | 1081 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, |
1078 | GFP_KERNEL); | 1082 | GFP_KERNEL); |
1079 | if (!rxdr->desc) { | 1083 | if (!rxdr->desc) { |
1080 | ret_val = 5; | 1084 | ret_val = 6; |
1081 | goto err_nomem; | 1085 | goto err_nomem; |
1082 | } | 1086 | } |
1083 | memset(rxdr->desc, 0, rxdr->size); | 1087 | memset(rxdr->desc, 0, rxdr->size); |
@@ -1101,7 +1105,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1101 | 1105 | ||
1102 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); | 1106 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); |
1103 | if (!skb) { | 1107 | if (!skb) { |
1104 | ret_val = 6; | 1108 | ret_val = 7; |
1105 | goto err_nomem; | 1109 | goto err_nomem; |
1106 | } | 1110 | } |
1107 | skb_reserve(skb, NET_IP_ALIGN); | 1111 | skb_reserve(skb, NET_IP_ALIGN); |
@@ -1110,6 +1114,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1110 | rxdr->buffer_info[i].dma = | 1114 | rxdr->buffer_info[i].dma = |
1111 | dma_map_single(&pdev->dev, skb->data, | 1115 | dma_map_single(&pdev->dev, skb->data, |
1112 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); | 1116 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); |
1117 | if (dma_mapping_error(&pdev->dev, rxdr->buffer_info[i].dma)) { | ||
1118 | ret_val = 8; | ||
1119 | goto err_nomem; | ||
1120 | } | ||
1113 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); | 1121 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); |
1114 | memset(skb->data, 0x00, skb->len); | 1122 | memset(skb->data, 0x00, skb->len); |
1115 | } | 1123 | } |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 948b86ffa4f0..7e615e2bf7e6 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -848,11 +848,16 @@ check_page: | |||
848 | } | 848 | } |
849 | } | 849 | } |
850 | 850 | ||
851 | if (!buffer_info->dma) | 851 | if (!buffer_info->dma) { |
852 | buffer_info->dma = dma_map_page(&pdev->dev, | 852 | buffer_info->dma = dma_map_page(&pdev->dev, |
853 | buffer_info->page, 0, | 853 | buffer_info->page, 0, |
854 | PAGE_SIZE, | 854 | PAGE_SIZE, |
855 | DMA_FROM_DEVICE); | 855 | DMA_FROM_DEVICE); |
856 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | ||
857 | adapter->alloc_rx_buff_failed++; | ||
858 | break; | ||
859 | } | ||
860 | } | ||
856 | 861 | ||
857 | rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); | 862 | rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); |
858 | rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); | 863 | rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index b64542acfa34..12b1d8480808 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1818,27 +1818,32 @@ out: | |||
1818 | **/ | 1818 | **/ |
1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) | 1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) |
1820 | { | 1820 | { |
1821 | u32 dtxswc; | 1821 | u32 reg_val, reg_offset; |
1822 | 1822 | ||
1823 | switch (hw->mac.type) { | 1823 | switch (hw->mac.type) { |
1824 | case e1000_82576: | 1824 | case e1000_82576: |
1825 | reg_offset = E1000_DTXSWC; | ||
1826 | break; | ||
1825 | case e1000_i350: | 1827 | case e1000_i350: |
1826 | dtxswc = rd32(E1000_DTXSWC); | 1828 | reg_offset = E1000_TXSWC; |
1827 | if (enable) { | ||
1828 | dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1829 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1830 | /* The PF can spoof - it has to in order to | ||
1831 | * support emulation mode NICs */ | ||
1832 | dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1833 | } else { | ||
1834 | dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1835 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1836 | } | ||
1837 | wr32(E1000_DTXSWC, dtxswc); | ||
1838 | break; | 1829 | break; |
1839 | default: | 1830 | default: |
1840 | break; | 1831 | return; |
1832 | } | ||
1833 | |||
1834 | reg_val = rd32(reg_offset); | ||
1835 | if (enable) { | ||
1836 | reg_val |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1837 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1838 | /* The PF can spoof - it has to in order to | ||
1839 | * support emulation mode NICs | ||
1840 | */ | ||
1841 | reg_val ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1842 | } else { | ||
1843 | reg_val &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1844 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1841 | } | 1845 | } |
1846 | wr32(reg_offset, reg_val); | ||
1842 | } | 1847 | } |
1843 | 1848 | ||
1844 | /** | 1849 | /** |
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 25151401c2ab..ab577a763a20 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -284,18 +284,10 @@ struct igb_q_vector { | |||
284 | enum e1000_ring_flags_t { | 284 | enum e1000_ring_flags_t { |
285 | IGB_RING_FLAG_RX_SCTP_CSUM, | 285 | IGB_RING_FLAG_RX_SCTP_CSUM, |
286 | IGB_RING_FLAG_RX_LB_VLAN_BSWAP, | 286 | IGB_RING_FLAG_RX_LB_VLAN_BSWAP, |
287 | IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, | ||
288 | IGB_RING_FLAG_TX_CTX_IDX, | 287 | IGB_RING_FLAG_TX_CTX_IDX, |
289 | IGB_RING_FLAG_TX_DETECT_HANG | 288 | IGB_RING_FLAG_TX_DETECT_HANG |
290 | }; | 289 | }; |
291 | 290 | ||
292 | #define ring_uses_build_skb(ring) \ | ||
293 | test_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | ||
294 | #define set_ring_build_skb_enabled(ring) \ | ||
295 | set_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | ||
296 | #define clear_ring_build_skb_enabled(ring) \ | ||
297 | clear_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | ||
298 | |||
299 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) | 291 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) |
300 | 292 | ||
301 | #define IGB_RX_DESC(R, i) \ | 293 | #define IGB_RX_DESC(R, i) \ |
diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c index 4623502054d5..0478a1abe541 100644 --- a/drivers/net/ethernet/intel/igb/igb_hwmon.c +++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
40 | 40 | ||
41 | #ifdef CONFIG_IGB_HWMON | 41 | #ifdef CONFIG_IGB_HWMON |
42 | struct i2c_board_info i350_sensor_info = { | 42 | static struct i2c_board_info i350_sensor_info = { |
43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), | 43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), |
44 | }; | 44 | }; |
45 | 45 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 4dbd62968c7a..64f75291e3a5 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -2542,8 +2542,8 @@ static void igb_probe_vfs(struct igb_adapter *adapter) | |||
2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) | 2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) |
2543 | return; | 2543 | return; |
2544 | 2544 | ||
2545 | igb_enable_sriov(pdev, max_vfs); | ||
2546 | pci_sriov_set_totalvfs(pdev, 7); | 2545 | pci_sriov_set_totalvfs(pdev, 7); |
2546 | igb_enable_sriov(pdev, max_vfs); | ||
2547 | 2547 | ||
2548 | #endif /* CONFIG_PCI_IOV */ | 2548 | #endif /* CONFIG_PCI_IOV */ |
2549 | } | 2549 | } |
@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter) | |||
2652 | if (max_vfs > 7) { | 2652 | if (max_vfs > 7) { |
2653 | dev_warn(&pdev->dev, | 2653 | dev_warn(&pdev->dev, |
2654 | "Maximum of 7 VFs per PF, using max\n"); | 2654 | "Maximum of 7 VFs per PF, using max\n"); |
2655 | adapter->vfs_allocated_count = 7; | 2655 | max_vfs = adapter->vfs_allocated_count = 7; |
2656 | } else | 2656 | } else |
2657 | adapter->vfs_allocated_count = max_vfs; | 2657 | adapter->vfs_allocated_count = max_vfs; |
2658 | if (adapter->vfs_allocated_count) | 2658 | if (adapter->vfs_allocated_count) |
@@ -3350,20 +3350,6 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, | |||
3350 | wr32(E1000_RXDCTL(reg_idx), rxdctl); | 3350 | wr32(E1000_RXDCTL(reg_idx), rxdctl); |
3351 | } | 3351 | } |
3352 | 3352 | ||
3353 | static void igb_set_rx_buffer_len(struct igb_adapter *adapter, | ||
3354 | struct igb_ring *rx_ring) | ||
3355 | { | ||
3356 | #define IGB_MAX_BUILD_SKB_SIZE \ | ||
3357 | (SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) - \ | ||
3358 | (NET_SKB_PAD + NET_IP_ALIGN + IGB_TS_HDR_LEN)) | ||
3359 | |||
3360 | /* set build_skb flag */ | ||
3361 | if (adapter->max_frame_size <= IGB_MAX_BUILD_SKB_SIZE) | ||
3362 | set_ring_build_skb_enabled(rx_ring); | ||
3363 | else | ||
3364 | clear_ring_build_skb_enabled(rx_ring); | ||
3365 | } | ||
3366 | |||
3367 | /** | 3353 | /** |
3368 | * igb_configure_rx - Configure receive Unit after Reset | 3354 | * igb_configure_rx - Configure receive Unit after Reset |
3369 | * @adapter: board private structure | 3355 | * @adapter: board private structure |
@@ -3383,11 +3369,8 @@ static void igb_configure_rx(struct igb_adapter *adapter) | |||
3383 | 3369 | ||
3384 | /* Setup the HW Rx Head and Tail Descriptor Pointers and | 3370 | /* Setup the HW Rx Head and Tail Descriptor Pointers and |
3385 | * the Base and Length of the Rx Descriptor Ring */ | 3371 | * the Base and Length of the Rx Descriptor Ring */ |
3386 | for (i = 0; i < adapter->num_rx_queues; i++) { | 3372 | for (i = 0; i < adapter->num_rx_queues; i++) |
3387 | struct igb_ring *rx_ring = adapter->rx_ring[i]; | 3373 | igb_configure_rx_ring(adapter, adapter->rx_ring[i]); |
3388 | igb_set_rx_buffer_len(adapter, rx_ring); | ||
3389 | igb_configure_rx_ring(adapter, rx_ring); | ||
3390 | } | ||
3391 | } | 3374 | } |
3392 | 3375 | ||
3393 | /** | 3376 | /** |
@@ -6203,78 +6186,6 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, | |||
6203 | return igb_can_reuse_rx_page(rx_buffer, page, truesize); | 6186 | return igb_can_reuse_rx_page(rx_buffer, page, truesize); |
6204 | } | 6187 | } |
6205 | 6188 | ||
6206 | static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring, | ||
6207 | union e1000_adv_rx_desc *rx_desc) | ||
6208 | { | ||
6209 | struct igb_rx_buffer *rx_buffer; | ||
6210 | struct sk_buff *skb; | ||
6211 | struct page *page; | ||
6212 | void *page_addr; | ||
6213 | unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); | ||
6214 | #if (PAGE_SIZE < 8192) | ||
6215 | unsigned int truesize = IGB_RX_BUFSZ; | ||
6216 | #else | ||
6217 | unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + | ||
6218 | SKB_DATA_ALIGN(NET_SKB_PAD + | ||
6219 | NET_IP_ALIGN + | ||
6220 | size); | ||
6221 | #endif | ||
6222 | |||
6223 | /* If we spanned a buffer we have a huge mess so test for it */ | ||
6224 | BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))); | ||
6225 | |||
6226 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; | ||
6227 | page = rx_buffer->page; | ||
6228 | prefetchw(page); | ||
6229 | |||
6230 | page_addr = page_address(page) + rx_buffer->page_offset; | ||
6231 | |||
6232 | /* prefetch first cache line of first page */ | ||
6233 | prefetch(page_addr + NET_SKB_PAD + NET_IP_ALIGN); | ||
6234 | #if L1_CACHE_BYTES < 128 | ||
6235 | prefetch(page_addr + L1_CACHE_BYTES + NET_SKB_PAD + NET_IP_ALIGN); | ||
6236 | #endif | ||
6237 | |||
6238 | /* build an skb to around the page buffer */ | ||
6239 | skb = build_skb(page_addr, truesize); | ||
6240 | if (unlikely(!skb)) { | ||
6241 | rx_ring->rx_stats.alloc_failed++; | ||
6242 | return NULL; | ||
6243 | } | ||
6244 | |||
6245 | /* we are reusing so sync this buffer for CPU use */ | ||
6246 | dma_sync_single_range_for_cpu(rx_ring->dev, | ||
6247 | rx_buffer->dma, | ||
6248 | rx_buffer->page_offset, | ||
6249 | IGB_RX_BUFSZ, | ||
6250 | DMA_FROM_DEVICE); | ||
6251 | |||
6252 | /* update pointers within the skb to store the data */ | ||
6253 | skb_reserve(skb, NET_IP_ALIGN + NET_SKB_PAD); | ||
6254 | __skb_put(skb, size); | ||
6255 | |||
6256 | /* pull timestamp out of packet data */ | ||
6257 | if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { | ||
6258 | igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb); | ||
6259 | __skb_pull(skb, IGB_TS_HDR_LEN); | ||
6260 | } | ||
6261 | |||
6262 | if (igb_can_reuse_rx_page(rx_buffer, page, truesize)) { | ||
6263 | /* hand second half of page back to the ring */ | ||
6264 | igb_reuse_rx_page(rx_ring, rx_buffer); | ||
6265 | } else { | ||
6266 | /* we are not reusing the buffer so unmap it */ | ||
6267 | dma_unmap_page(rx_ring->dev, rx_buffer->dma, | ||
6268 | PAGE_SIZE, DMA_FROM_DEVICE); | ||
6269 | } | ||
6270 | |||
6271 | /* clear contents of buffer_info */ | ||
6272 | rx_buffer->dma = 0; | ||
6273 | rx_buffer->page = NULL; | ||
6274 | |||
6275 | return skb; | ||
6276 | } | ||
6277 | |||
6278 | static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, | 6189 | static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, |
6279 | union e1000_adv_rx_desc *rx_desc, | 6190 | union e1000_adv_rx_desc *rx_desc, |
6280 | struct sk_buff *skb) | 6191 | struct sk_buff *skb) |
@@ -6690,10 +6601,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) | |||
6690 | rmb(); | 6601 | rmb(); |
6691 | 6602 | ||
6692 | /* retrieve a buffer from the ring */ | 6603 | /* retrieve a buffer from the ring */ |
6693 | if (ring_uses_build_skb(rx_ring)) | 6604 | skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); |
6694 | skb = igb_build_rx_buffer(rx_ring, rx_desc); | ||
6695 | else | ||
6696 | skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); | ||
6697 | 6605 | ||
6698 | /* exit if we failed to retrieve a buffer */ | 6606 | /* exit if we failed to retrieve a buffer */ |
6699 | if (!skb) | 6607 | if (!skb) |
@@ -6780,14 +6688,6 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring, | |||
6780 | return true; | 6688 | return true; |
6781 | } | 6689 | } |
6782 | 6690 | ||
6783 | static inline unsigned int igb_rx_offset(struct igb_ring *rx_ring) | ||
6784 | { | ||
6785 | if (ring_uses_build_skb(rx_ring)) | ||
6786 | return NET_SKB_PAD + NET_IP_ALIGN; | ||
6787 | else | ||
6788 | return 0; | ||
6789 | } | ||
6790 | |||
6791 | /** | 6691 | /** |
6792 | * igb_alloc_rx_buffers - Replace used receive buffers; packet split | 6692 | * igb_alloc_rx_buffers - Replace used receive buffers; packet split |
6793 | * @adapter: address of board private structure | 6693 | * @adapter: address of board private structure |
@@ -6814,9 +6714,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) | |||
6814 | * Refresh the desc even if buffer_addrs didn't change | 6714 | * Refresh the desc even if buffer_addrs didn't change |
6815 | * because each write-back erases this info. | 6715 | * because each write-back erases this info. |
6816 | */ | 6716 | */ |
6817 | rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + | 6717 | rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset); |
6818 | bi->page_offset + | ||
6819 | igb_rx_offset(rx_ring)); | ||
6820 | 6718 | ||
6821 | rx_desc++; | 6719 | rx_desc++; |
6822 | bi++; | 6720 | bi++; |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 0987822359f0..0a237507ee85 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter) | |||
740 | case e1000_82576: | 740 | case e1000_82576: |
741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); | 741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); |
742 | adapter->ptp_caps.owner = THIS_MODULE; | 742 | adapter->ptp_caps.owner = THIS_MODULE; |
743 | adapter->ptp_caps.max_adj = 1000000000; | 743 | adapter->ptp_caps.max_adj = 999999881; |
744 | adapter->ptp_caps.n_ext_ts = 0; | 744 | adapter->ptp_caps.n_ext_ts = 0; |
745 | adapter->ptp_caps.pps = 0; | 745 | adapter->ptp_caps.pps = 0; |
746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; | 746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index ea4808373435..b5f94abe3cff 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -2159,6 +2159,10 @@ map_skb: | |||
2159 | skb->data, | 2159 | skb->data, |
2160 | adapter->rx_buffer_len, | 2160 | adapter->rx_buffer_len, |
2161 | DMA_FROM_DEVICE); | 2161 | DMA_FROM_DEVICE); |
2162 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | ||
2163 | adapter->alloc_rx_buff_failed++; | ||
2164 | break; | ||
2165 | } | ||
2162 | 2166 | ||
2163 | rx_desc = IXGB_RX_DESC(*rx_ring, i); | 2167 | rx_desc = IXGB_RX_DESC(*rx_ring, i); |
2164 | rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); | 2168 | rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); |
@@ -2168,7 +2172,8 @@ map_skb: | |||
2168 | rx_desc->status = 0; | 2172 | rx_desc->status = 0; |
2169 | 2173 | ||
2170 | 2174 | ||
2171 | if (++i == rx_ring->count) i = 0; | 2175 | if (++i == rx_ring->count) |
2176 | i = 0; | ||
2172 | buffer_info = &rx_ring->buffer_info[i]; | 2177 | buffer_info = &rx_ring->buffer_info[i]; |
2173 | } | 2178 | } |
2174 | 2179 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index db5611ae407e..79f4a26ea6cc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7922,12 +7922,19 @@ static int __init ixgbe_init_module(void) | |||
7922 | ixgbe_dbg_init(); | 7922 | ixgbe_dbg_init(); |
7923 | #endif /* CONFIG_DEBUG_FS */ | 7923 | #endif /* CONFIG_DEBUG_FS */ |
7924 | 7924 | ||
7925 | ret = pci_register_driver(&ixgbe_driver); | ||
7926 | if (ret) { | ||
7927 | #ifdef CONFIG_DEBUG_FS | ||
7928 | ixgbe_dbg_exit(); | ||
7929 | #endif /* CONFIG_DEBUG_FS */ | ||
7930 | return ret; | ||
7931 | } | ||
7932 | |||
7925 | #ifdef CONFIG_IXGBE_DCA | 7933 | #ifdef CONFIG_IXGBE_DCA |
7926 | dca_register_notify(&dca_notifier); | 7934 | dca_register_notify(&dca_notifier); |
7927 | #endif | 7935 | #endif |
7928 | 7936 | ||
7929 | ret = pci_register_driver(&ixgbe_driver); | 7937 | return 0; |
7930 | return ret; | ||
7931 | } | 7938 | } |
7932 | 7939 | ||
7933 | module_init(ixgbe_init_module); | 7940 | module_init(ixgbe_init_module); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index d44b4d21268c..97e33669c0b9 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | |||
@@ -1049,6 +1049,12 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) | |||
1049 | if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) | 1049 | if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) |
1050 | return -EINVAL; | 1050 | return -EINVAL; |
1051 | if (vlan || qos) { | 1051 | if (vlan || qos) { |
1052 | if (adapter->vfinfo[vf].pf_vlan) | ||
1053 | err = ixgbe_set_vf_vlan(adapter, false, | ||
1054 | adapter->vfinfo[vf].pf_vlan, | ||
1055 | vf); | ||
1056 | if (err) | ||
1057 | goto out; | ||
1052 | err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); | 1058 | err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); |
1053 | if (err) | 1059 | if (err) |
1054 | goto out; | 1060 | goto out; |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index c3db6cd69b68..2b6cb5ca48ee 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -944,9 +944,17 @@ free_queue_irqs: | |||
944 | free_irq(adapter->msix_entries[vector].vector, | 944 | free_irq(adapter->msix_entries[vector].vector, |
945 | adapter->q_vector[vector]); | 945 | adapter->q_vector[vector]); |
946 | } | 946 | } |
947 | pci_disable_msix(adapter->pdev); | 947 | /* This failure is non-recoverable - it indicates the system is |
948 | kfree(adapter->msix_entries); | 948 | * out of MSIX vector resources and the VF driver cannot run |
949 | adapter->msix_entries = NULL; | 949 | * without them. Set the number of msix vectors to zero |
950 | * indicating that not enough can be allocated. The error | ||
951 | * will be returned to the user indicating device open failed. | ||
952 | * Any further attempts to force the driver to open will also | ||
953 | * fail. The only way to recover is to unload the driver and | ||
954 | * reload it again. If the system has recovered some MSIX | ||
955 | * vectors then it may succeed. | ||
956 | */ | ||
957 | adapter->num_msix_vectors = 0; | ||
950 | return err; | 958 | return err; |
951 | } | 959 | } |
952 | 960 | ||
@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2572 | struct ixgbe_hw *hw = &adapter->hw; | 2580 | struct ixgbe_hw *hw = &adapter->hw; |
2573 | int err; | 2581 | int err; |
2574 | 2582 | ||
2583 | /* A previous failure to open the device because of a lack of | ||
2584 | * available MSIX vector resources may have reset the number | ||
2585 | * of msix vectors variable to zero. The only way to recover | ||
2586 | * is to unload/reload the driver and hope that the system has | ||
2587 | * been able to recover some MSIX vector resources. | ||
2588 | */ | ||
2589 | if (!adapter->num_msix_vectors) | ||
2590 | return -ENOMEM; | ||
2591 | |||
2575 | /* disallow open during test */ | 2592 | /* disallow open during test */ |
2576 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) | 2593 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) |
2577 | return -EBUSY; | 2594 | return -EBUSY; |
@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2628 | 2645 | ||
2629 | err_req_irq: | 2646 | err_req_irq: |
2630 | ixgbevf_down(adapter); | 2647 | ixgbevf_down(adapter); |
2631 | ixgbevf_free_irq(adapter); | ||
2632 | err_setup_rx: | 2648 | err_setup_rx: |
2633 | ixgbevf_free_all_rx_resources(adapter); | 2649 | ixgbevf_free_all_rx_resources(adapter); |
2634 | err_setup_tx: | 2650 | err_setup_tx: |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 6a2127489af7..bfdb06860397 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -769,7 +769,7 @@ ltq_etop_probe(struct platform_device *pdev) | |||
769 | return 0; | 769 | return 0; |
770 | 770 | ||
771 | err_free: | 771 | err_free: |
772 | kfree(dev); | 772 | free_netdev(dev); |
773 | err_out: | 773 | err_out: |
774 | return err; | 774 | return err; |
775 | } | 775 | } |
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig index edfba9370922..434e33c527df 100644 --- a/drivers/net/ethernet/marvell/Kconfig +++ b/drivers/net/ethernet/marvell/Kconfig | |||
@@ -33,6 +33,7 @@ config MV643XX_ETH | |||
33 | 33 | ||
34 | config MVMDIO | 34 | config MVMDIO |
35 | tristate "Marvell MDIO interface support" | 35 | tristate "Marvell MDIO interface support" |
36 | select PHYLIB | ||
36 | ---help--- | 37 | ---help--- |
37 | This driver supports the MDIO interface found in the network | 38 | This driver supports the MDIO interface found in the network |
38 | interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, | 39 | interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, |
@@ -45,7 +46,6 @@ config MVMDIO | |||
45 | config MVNETA | 46 | config MVNETA |
46 | tristate "Marvell Armada 370/XP network interface support" | 47 | tristate "Marvell Armada 370/XP network interface support" |
47 | depends on MACH_ARMADA_370_XP | 48 | depends on MACH_ARMADA_370_XP |
48 | select PHYLIB | ||
49 | select MVMDIO | 49 | select MVMDIO |
50 | ---help--- | 50 | ---help--- |
51 | This driver supports the network interface units in the | 51 | This driver supports the network interface units in the |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index cd345b8969bc..a47a097c21e1 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -374,7 +374,6 @@ static int rxq_number = 8; | |||
374 | static int txq_number = 8; | 374 | static int txq_number = 8; |
375 | 375 | ||
376 | static int rxq_def; | 376 | static int rxq_def; |
377 | static int txq_def; | ||
378 | 377 | ||
379 | #define MVNETA_DRIVER_NAME "mvneta" | 378 | #define MVNETA_DRIVER_NAME "mvneta" |
380 | #define MVNETA_DRIVER_VERSION "1.0" | 379 | #define MVNETA_DRIVER_VERSION "1.0" |
@@ -1475,7 +1474,8 @@ error: | |||
1475 | static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) | 1474 | static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) |
1476 | { | 1475 | { |
1477 | struct mvneta_port *pp = netdev_priv(dev); | 1476 | struct mvneta_port *pp = netdev_priv(dev); |
1478 | struct mvneta_tx_queue *txq = &pp->txqs[txq_def]; | 1477 | u16 txq_id = skb_get_queue_mapping(skb); |
1478 | struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; | ||
1479 | struct mvneta_tx_desc *tx_desc; | 1479 | struct mvneta_tx_desc *tx_desc; |
1480 | struct netdev_queue *nq; | 1480 | struct netdev_queue *nq; |
1481 | int frags = 0; | 1481 | int frags = 0; |
@@ -1485,7 +1485,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) | |||
1485 | goto out; | 1485 | goto out; |
1486 | 1486 | ||
1487 | frags = skb_shinfo(skb)->nr_frags + 1; | 1487 | frags = skb_shinfo(skb)->nr_frags + 1; |
1488 | nq = netdev_get_tx_queue(dev, txq_def); | 1488 | nq = netdev_get_tx_queue(dev, txq_id); |
1489 | 1489 | ||
1490 | /* Get a descriptor for the first part of the packet */ | 1490 | /* Get a descriptor for the first part of the packet */ |
1491 | tx_desc = mvneta_txq_next_desc_get(txq); | 1491 | tx_desc = mvneta_txq_next_desc_get(txq); |
@@ -2689,7 +2689,7 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2689 | return -EINVAL; | 2689 | return -EINVAL; |
2690 | } | 2690 | } |
2691 | 2691 | ||
2692 | dev = alloc_etherdev_mq(sizeof(struct mvneta_port), 8); | 2692 | dev = alloc_etherdev_mqs(sizeof(struct mvneta_port), txq_number, rxq_number); |
2693 | if (!dev) | 2693 | if (!dev) |
2694 | return -ENOMEM; | 2694 | return -ENOMEM; |
2695 | 2695 | ||
@@ -2771,16 +2771,17 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2771 | 2771 | ||
2772 | netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight); | 2772 | netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight); |
2773 | 2773 | ||
2774 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2775 | dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2776 | dev->vlan_features |= NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2777 | dev->priv_flags |= IFF_UNICAST_FLT; | ||
2778 | |||
2774 | err = register_netdev(dev); | 2779 | err = register_netdev(dev); |
2775 | if (err < 0) { | 2780 | if (err < 0) { |
2776 | dev_err(&pdev->dev, "failed to register\n"); | 2781 | dev_err(&pdev->dev, "failed to register\n"); |
2777 | goto err_deinit; | 2782 | goto err_deinit; |
2778 | } | 2783 | } |
2779 | 2784 | ||
2780 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2781 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2782 | dev->priv_flags |= IFF_UNICAST_FLT; | ||
2783 | |||
2784 | netdev_info(dev, "mac: %pM\n", dev->dev_addr); | 2785 | netdev_info(dev, "mac: %pM\n", dev->dev_addr); |
2785 | 2786 | ||
2786 | platform_set_drvdata(pdev, pp->dev); | 2787 | platform_set_drvdata(pdev, pp->dev); |
@@ -2843,4 +2844,3 @@ module_param(rxq_number, int, S_IRUGO); | |||
2843 | module_param(txq_number, int, S_IRUGO); | 2844 | module_param(txq_number, int, S_IRUGO); |
2844 | 2845 | ||
2845 | module_param(rxq_def, int, S_IRUGO); | 2846 | module_param(rxq_def, int, S_IRUGO); |
2846 | module_param(txq_def, int, S_IRUGO); | ||
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index fc07ca35721b..6a0e671fcecd 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -1067,7 +1067,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space) | |||
1067 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); | 1067 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); |
1068 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); | 1068 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); |
1069 | 1069 | ||
1070 | tp = space - 2048/8; | 1070 | tp = space - 8192/8; |
1071 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); | 1071 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); |
1072 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); | 1072 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); |
1073 | } else { | 1073 | } else { |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index 615ac63ea860..ec6dcd80152b 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
@@ -2074,7 +2074,7 @@ enum { | |||
2074 | GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ | 2074 | GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ |
2075 | GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ | 2075 | GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ |
2076 | 2076 | ||
2077 | #define GMAC_DEF_MSK GM_IS_TX_FF_UR | 2077 | #define GMAC_DEF_MSK (GM_IS_TX_FF_UR | GM_IS_RX_FF_OR) |
2078 | }; | 2078 | }; |
2079 | 2079 | ||
2080 | /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ | 2080 | /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 995d4b6d5c1e..30d78f806dc3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -411,8 +411,8 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
411 | 411 | ||
412 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) | 412 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) |
413 | { | 413 | { |
414 | unsigned int i; | 414 | int i; |
415 | for (i = ETH_ALEN - 1; i; --i) { | 415 | for (i = ETH_ALEN - 1; i >= 0; --i) { |
416 | dst_mac[i] = src_mac & 0xff; | 416 | dst_mac[i] = src_mac & 0xff; |
417 | src_mac >>= 8; | 417 | src_mac >>= 8; |
418 | } | 418 | } |
@@ -1637,6 +1637,17 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1637 | /* Flush multicast filter */ | 1637 | /* Flush multicast filter */ |
1638 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG); | 1638 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG); |
1639 | 1639 | ||
1640 | /* Remove flow steering rules for the port*/ | ||
1641 | if (mdev->dev->caps.steering_mode == | ||
1642 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1643 | ASSERT_RTNL(); | ||
1644 | list_for_each_entry_safe(flow, tmp_flow, | ||
1645 | &priv->ethtool_list, list) { | ||
1646 | mlx4_flow_detach(mdev->dev, flow->id); | ||
1647 | list_del(&flow->list); | ||
1648 | } | ||
1649 | } | ||
1650 | |||
1640 | mlx4_en_destroy_drop_qp(priv); | 1651 | mlx4_en_destroy_drop_qp(priv); |
1641 | 1652 | ||
1642 | /* Free TX Rings */ | 1653 | /* Free TX Rings */ |
@@ -1657,17 +1668,6 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1657 | if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) | 1668 | if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) |
1658 | mdev->mac_removed[priv->port] = 1; | 1669 | mdev->mac_removed[priv->port] = 1; |
1659 | 1670 | ||
1660 | /* Remove flow steering rules for the port*/ | ||
1661 | if (mdev->dev->caps.steering_mode == | ||
1662 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1663 | ASSERT_RTNL(); | ||
1664 | list_for_each_entry_safe(flow, tmp_flow, | ||
1665 | &priv->ethtool_list, list) { | ||
1666 | mlx4_flow_detach(mdev->dev, flow->id); | ||
1667 | list_del(&flow->list); | ||
1668 | } | ||
1669 | } | ||
1670 | |||
1671 | /* Free RX Rings */ | 1671 | /* Free RX Rings */ |
1672 | for (i = 0; i < priv->rx_ring_num; i++) { | 1672 | for (i = 0; i < priv->rx_ring_num; i++) { |
1673 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); | 1673 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 251ae2f93116..8e3123a1df88 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -771,7 +771,7 @@ int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave, | |||
771 | struct mlx4_slave_event_eq_info *event_eq = | 771 | struct mlx4_slave_event_eq_info *event_eq = |
772 | priv->mfunc.master.slave_state[slave].event_eq; | 772 | priv->mfunc.master.slave_state[slave].event_eq; |
773 | u32 in_modifier = vhcr->in_modifier; | 773 | u32 in_modifier = vhcr->in_modifier; |
774 | u32 eqn = in_modifier & 0x1FF; | 774 | u32 eqn = in_modifier & 0x3FF; |
775 | u64 in_param = vhcr->in_param; | 775 | u64 in_param = vhcr->in_param; |
776 | int err = 0; | 776 | int err = 0; |
777 | int i; | 777 | int i; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 2995687f1aee..1391b52f443a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -99,6 +99,7 @@ struct res_qp { | |||
99 | struct list_head mcg_list; | 99 | struct list_head mcg_list; |
100 | spinlock_t mcg_spl; | 100 | spinlock_t mcg_spl; |
101 | int local_qpn; | 101 | int local_qpn; |
102 | atomic_t ref_count; | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | enum res_mtt_states { | 105 | enum res_mtt_states { |
@@ -197,6 +198,7 @@ enum res_fs_rule_states { | |||
197 | 198 | ||
198 | struct res_fs_rule { | 199 | struct res_fs_rule { |
199 | struct res_common com; | 200 | struct res_common com; |
201 | int qpn; | ||
200 | }; | 202 | }; |
201 | 203 | ||
202 | static void *res_tracker_lookup(struct rb_root *root, u64 res_id) | 204 | static void *res_tracker_lookup(struct rb_root *root, u64 res_id) |
@@ -355,7 +357,7 @@ static int mpt_mask(struct mlx4_dev *dev) | |||
355 | return dev->caps.num_mpts - 1; | 357 | return dev->caps.num_mpts - 1; |
356 | } | 358 | } |
357 | 359 | ||
358 | static void *find_res(struct mlx4_dev *dev, int res_id, | 360 | static void *find_res(struct mlx4_dev *dev, u64 res_id, |
359 | enum mlx4_resource type) | 361 | enum mlx4_resource type) |
360 | { | 362 | { |
361 | struct mlx4_priv *priv = mlx4_priv(dev); | 363 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -447,6 +449,7 @@ static struct res_common *alloc_qp_tr(int id) | |||
447 | ret->local_qpn = id; | 449 | ret->local_qpn = id; |
448 | INIT_LIST_HEAD(&ret->mcg_list); | 450 | INIT_LIST_HEAD(&ret->mcg_list); |
449 | spin_lock_init(&ret->mcg_spl); | 451 | spin_lock_init(&ret->mcg_spl); |
452 | atomic_set(&ret->ref_count, 0); | ||
450 | 453 | ||
451 | return &ret->com; | 454 | return &ret->com; |
452 | } | 455 | } |
@@ -554,7 +557,7 @@ static struct res_common *alloc_xrcdn_tr(int id) | |||
554 | return &ret->com; | 557 | return &ret->com; |
555 | } | 558 | } |
556 | 559 | ||
557 | static struct res_common *alloc_fs_rule_tr(u64 id) | 560 | static struct res_common *alloc_fs_rule_tr(u64 id, int qpn) |
558 | { | 561 | { |
559 | struct res_fs_rule *ret; | 562 | struct res_fs_rule *ret; |
560 | 563 | ||
@@ -564,7 +567,7 @@ static struct res_common *alloc_fs_rule_tr(u64 id) | |||
564 | 567 | ||
565 | ret->com.res_id = id; | 568 | ret->com.res_id = id; |
566 | ret->com.state = RES_FS_RULE_ALLOCATED; | 569 | ret->com.state = RES_FS_RULE_ALLOCATED; |
567 | 570 | ret->qpn = qpn; | |
568 | return &ret->com; | 571 | return &ret->com; |
569 | } | 572 | } |
570 | 573 | ||
@@ -602,7 +605,7 @@ static struct res_common *alloc_tr(u64 id, enum mlx4_resource type, int slave, | |||
602 | ret = alloc_xrcdn_tr(id); | 605 | ret = alloc_xrcdn_tr(id); |
603 | break; | 606 | break; |
604 | case RES_FS_RULE: | 607 | case RES_FS_RULE: |
605 | ret = alloc_fs_rule_tr(id); | 608 | ret = alloc_fs_rule_tr(id, extra); |
606 | break; | 609 | break; |
607 | default: | 610 | default: |
608 | return NULL; | 611 | return NULL; |
@@ -671,10 +674,14 @@ undo: | |||
671 | 674 | ||
672 | static int remove_qp_ok(struct res_qp *res) | 675 | static int remove_qp_ok(struct res_qp *res) |
673 | { | 676 | { |
674 | if (res->com.state == RES_QP_BUSY) | 677 | if (res->com.state == RES_QP_BUSY || atomic_read(&res->ref_count) || |
678 | !list_empty(&res->mcg_list)) { | ||
679 | pr_err("resource tracker: fail to remove qp, state %d, ref_count %d\n", | ||
680 | res->com.state, atomic_read(&res->ref_count)); | ||
675 | return -EBUSY; | 681 | return -EBUSY; |
676 | else if (res->com.state != RES_QP_RESERVED) | 682 | } else if (res->com.state != RES_QP_RESERVED) { |
677 | return -EPERM; | 683 | return -EPERM; |
684 | } | ||
678 | 685 | ||
679 | return 0; | 686 | return 0; |
680 | } | 687 | } |
@@ -3124,6 +3131,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3124 | struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; | 3131 | struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; |
3125 | int err; | 3132 | int err; |
3126 | int qpn; | 3133 | int qpn; |
3134 | struct res_qp *rqp; | ||
3127 | struct mlx4_net_trans_rule_hw_ctrl *ctrl; | 3135 | struct mlx4_net_trans_rule_hw_ctrl *ctrl; |
3128 | struct _rule_hw *rule_header; | 3136 | struct _rule_hw *rule_header; |
3129 | int header_id; | 3137 | int header_id; |
@@ -3134,7 +3142,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3134 | 3142 | ||
3135 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; | 3143 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; |
3136 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; | 3144 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; |
3137 | err = get_res(dev, slave, qpn, RES_QP, NULL); | 3145 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
3138 | if (err) { | 3146 | if (err) { |
3139 | pr_err("Steering rule with qpn 0x%x rejected.\n", qpn); | 3147 | pr_err("Steering rule with qpn 0x%x rejected.\n", qpn); |
3140 | return err; | 3148 | return err; |
@@ -3175,14 +3183,16 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3175 | if (err) | 3183 | if (err) |
3176 | goto err_put; | 3184 | goto err_put; |
3177 | 3185 | ||
3178 | err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, 0); | 3186 | err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, qpn); |
3179 | if (err) { | 3187 | if (err) { |
3180 | mlx4_err(dev, "Fail to add flow steering resources.\n "); | 3188 | mlx4_err(dev, "Fail to add flow steering resources.\n "); |
3181 | /* detach rule*/ | 3189 | /* detach rule*/ |
3182 | mlx4_cmd(dev, vhcr->out_param, 0, 0, | 3190 | mlx4_cmd(dev, vhcr->out_param, 0, 0, |
3183 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 3191 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
3184 | MLX4_CMD_NATIVE); | 3192 | MLX4_CMD_NATIVE); |
3193 | goto err_put; | ||
3185 | } | 3194 | } |
3195 | atomic_inc(&rqp->ref_count); | ||
3186 | err_put: | 3196 | err_put: |
3187 | put_res(dev, slave, qpn, RES_QP); | 3197 | put_res(dev, slave, qpn, RES_QP); |
3188 | return err; | 3198 | return err; |
@@ -3195,20 +3205,35 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3195 | struct mlx4_cmd_info *cmd) | 3205 | struct mlx4_cmd_info *cmd) |
3196 | { | 3206 | { |
3197 | int err; | 3207 | int err; |
3208 | struct res_qp *rqp; | ||
3209 | struct res_fs_rule *rrule; | ||
3198 | 3210 | ||
3199 | if (dev->caps.steering_mode != | 3211 | if (dev->caps.steering_mode != |
3200 | MLX4_STEERING_MODE_DEVICE_MANAGED) | 3212 | MLX4_STEERING_MODE_DEVICE_MANAGED) |
3201 | return -EOPNOTSUPP; | 3213 | return -EOPNOTSUPP; |
3202 | 3214 | ||
3215 | err = get_res(dev, slave, vhcr->in_param, RES_FS_RULE, &rrule); | ||
3216 | if (err) | ||
3217 | return err; | ||
3218 | /* Release the rule form busy state before removal */ | ||
3219 | put_res(dev, slave, vhcr->in_param, RES_FS_RULE); | ||
3220 | err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp); | ||
3221 | if (err) | ||
3222 | return err; | ||
3223 | |||
3203 | err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); | 3224 | err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); |
3204 | if (err) { | 3225 | if (err) { |
3205 | mlx4_err(dev, "Fail to remove flow steering resources.\n "); | 3226 | mlx4_err(dev, "Fail to remove flow steering resources.\n "); |
3206 | return err; | 3227 | goto out; |
3207 | } | 3228 | } |
3208 | 3229 | ||
3209 | err = mlx4_cmd(dev, vhcr->in_param, 0, 0, | 3230 | err = mlx4_cmd(dev, vhcr->in_param, 0, 0, |
3210 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 3231 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
3211 | MLX4_CMD_NATIVE); | 3232 | MLX4_CMD_NATIVE); |
3233 | if (!err) | ||
3234 | atomic_dec(&rqp->ref_count); | ||
3235 | out: | ||
3236 | put_res(dev, slave, rrule->qpn, RES_QP); | ||
3212 | return err; | 3237 | return err; |
3213 | } | 3238 | } |
3214 | 3239 | ||
@@ -3806,6 +3831,7 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) | |||
3806 | mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); | 3831 | mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); |
3807 | /*VLAN*/ | 3832 | /*VLAN*/ |
3808 | rem_slave_macs(dev, slave); | 3833 | rem_slave_macs(dev, slave); |
3834 | rem_slave_fs_rule(dev, slave); | ||
3809 | rem_slave_qps(dev, slave); | 3835 | rem_slave_qps(dev, slave); |
3810 | rem_slave_srqs(dev, slave); | 3836 | rem_slave_srqs(dev, slave); |
3811 | rem_slave_cqs(dev, slave); | 3837 | rem_slave_cqs(dev, slave); |
@@ -3814,6 +3840,5 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) | |||
3814 | rem_slave_mtts(dev, slave); | 3840 | rem_slave_mtts(dev, slave); |
3815 | rem_slave_counters(dev, slave); | 3841 | rem_slave_counters(dev, slave); |
3816 | rem_slave_xrcdns(dev, slave); | 3842 | rem_slave_xrcdns(dev, slave); |
3817 | rem_slave_fs_rule(dev, slave); | ||
3818 | mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); | 3843 | mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); |
3819 | } | 3844 | } |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index 33bcb63d56a2..8fb481252e2c 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -528,7 +528,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) | |||
528 | for (; rxfc != 0; rxfc--) { | 528 | for (; rxfc != 0; rxfc--) { |
529 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); | 529 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); |
530 | rxstat = rxh & 0xffff; | 530 | rxstat = rxh & 0xffff; |
531 | rxlen = rxh >> 16; | 531 | rxlen = (rxh >> 16) & 0xfff; |
532 | 532 | ||
533 | netif_dbg(ks, rx_status, ks->netdev, | 533 | netif_dbg(ks, rx_status, ks->netdev, |
534 | "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); | 534 | "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index c4122c86f829..efa29b712d5f 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1472,7 +1472,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) | |||
1472 | } | 1472 | } |
1473 | platform_set_drvdata(pdev, ndev); | 1473 | platform_set_drvdata(pdev, ndev); |
1474 | 1474 | ||
1475 | if (lpc_mii_init(pldat) != 0) | 1475 | ret = lpc_mii_init(pldat); |
1476 | if (ret) | ||
1476 | goto err_out_unregister_netdev; | 1477 | goto err_out_unregister_netdev; |
1477 | 1478 | ||
1478 | netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", | 1479 | netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 39ab4d09faaa..73ce7dd6b954 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -1726,9 +1726,9 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
1726 | 1726 | ||
1727 | skb->protocol = eth_type_trans(skb, netdev); | 1727 | skb->protocol = eth_type_trans(skb, netdev); |
1728 | if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) | 1728 | if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) |
1729 | skb->ip_summed = CHECKSUM_NONE; | ||
1730 | else | ||
1731 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1729 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1730 | else | ||
1731 | skb->ip_summed = CHECKSUM_NONE; | ||
1732 | 1732 | ||
1733 | napi_gro_receive(&adapter->napi, skb); | 1733 | napi_gro_receive(&adapter->napi, skb); |
1734 | (*work_done)++; | 1734 | (*work_done)++; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index cd5ae8813cb3..edd63f1230f3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -1500,6 +1500,12 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) | |||
1500 | } | 1500 | } |
1501 | } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); | 1501 | } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); |
1502 | 1502 | ||
1503 | /* Make sure carrier is off and queue is stopped during loopback */ | ||
1504 | if (netif_running(netdev)) { | ||
1505 | netif_carrier_off(netdev); | ||
1506 | netif_stop_queue(netdev); | ||
1507 | } | ||
1508 | |||
1503 | ret = qlcnic_do_lb_test(adapter, mode); | 1509 | ret = qlcnic_do_lb_test(adapter, mode); |
1504 | 1510 | ||
1505 | qlcnic_83xx_clear_lb_mode(adapter, mode); | 1511 | qlcnic_83xx_clear_lb_mode(adapter, mode); |
@@ -2780,6 +2786,7 @@ static u64 *qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter, | |||
2780 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | 2786 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) |
2781 | { | 2787 | { |
2782 | struct qlcnic_cmd_args cmd; | 2788 | struct qlcnic_cmd_args cmd; |
2789 | struct net_device *netdev = adapter->netdev; | ||
2783 | int ret = 0; | 2790 | int ret = 0; |
2784 | 2791 | ||
2785 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); | 2792 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); |
@@ -2789,7 +2796,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | |||
2789 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, | 2796 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
2790 | QLC_83XX_STAT_TX, &ret); | 2797 | QLC_83XX_STAT_TX, &ret); |
2791 | if (ret) { | 2798 | if (ret) { |
2792 | dev_info(&adapter->pdev->dev, "Error getting MAC stats\n"); | 2799 | netdev_err(netdev, "Error getting Tx stats\n"); |
2793 | goto out; | 2800 | goto out; |
2794 | } | 2801 | } |
2795 | /* Get MAC stats */ | 2802 | /* Get MAC stats */ |
@@ -2799,8 +2806,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | |||
2799 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, | 2806 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
2800 | QLC_83XX_STAT_MAC, &ret); | 2807 | QLC_83XX_STAT_MAC, &ret); |
2801 | if (ret) { | 2808 | if (ret) { |
2802 | dev_info(&adapter->pdev->dev, | 2809 | netdev_err(netdev, "Error getting MAC stats\n"); |
2803 | "Error getting Rx stats\n"); | ||
2804 | goto out; | 2810 | goto out; |
2805 | } | 2811 | } |
2806 | /* Get Rx stats */ | 2812 | /* Get Rx stats */ |
@@ -2810,8 +2816,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | |||
2810 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, | 2816 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
2811 | QLC_83XX_STAT_RX, &ret); | 2817 | QLC_83XX_STAT_RX, &ret); |
2812 | if (ret) | 2818 | if (ret) |
2813 | dev_info(&adapter->pdev->dev, | 2819 | netdev_err(netdev, "Error getting Rx stats\n"); |
2814 | "Error getting Tx stats\n"); | ||
2815 | out: | 2820 | out: |
2816 | qlcnic_free_mbx_args(&cmd); | 2821 | qlcnic_free_mbx_args(&cmd); |
2817 | } | 2822 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 0e630061bff3..5fa847fe388a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -358,8 +358,7 @@ set_flags: | |||
358 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); | 358 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); |
359 | } | 359 | } |
360 | opcode = TX_ETHER_PKT; | 360 | opcode = TX_ETHER_PKT; |
361 | if ((adapter->netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && | 361 | if (skb_is_gso(skb)) { |
362 | skb_shinfo(skb)->gso_size > 0) { | ||
363 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 362 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
364 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 363 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
365 | first_desc->total_hdr_length = hdr_len; | 364 | first_desc->total_hdr_length = hdr_len; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 987fb6f8adc3..5ef328af61d0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -200,10 +200,10 @@ beacon_err: | |||
200 | } | 200 | } |
201 | 201 | ||
202 | err = qlcnic_config_led(adapter, b_state, b_rate); | 202 | err = qlcnic_config_led(adapter, b_state, b_rate); |
203 | if (!err) | 203 | if (!err) { |
204 | err = len; | 204 | err = len; |
205 | else | ||
206 | ahw->beacon_state = b_state; | 205 | ahw->beacon_state = b_state; |
206 | } | ||
207 | 207 | ||
208 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) | 208 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) |
209 | qlcnic_diag_free_res(adapter->netdev, max_sds_rings); | 209 | qlcnic_diag_free_res(adapter->netdev, max_sds_rings); |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index a131d7b5d2fe..7e8d68263963 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #define DRV_NAME "qlge" | 19 | #define DRV_NAME "qlge" |
20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " | 20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " |
21 | #define DRV_VERSION "v1.00.00.31" | 21 | #define DRV_VERSION "v1.00.00.32" |
22 | 22 | ||
23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ | 23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ |
24 | 24 | ||
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c index 6f316ab23257..0780e039b271 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | |||
@@ -379,13 +379,13 @@ static int ql_get_settings(struct net_device *ndev, | |||
379 | 379 | ||
380 | ecmd->supported = SUPPORTED_10000baseT_Full; | 380 | ecmd->supported = SUPPORTED_10000baseT_Full; |
381 | ecmd->advertising = ADVERTISED_10000baseT_Full; | 381 | ecmd->advertising = ADVERTISED_10000baseT_Full; |
382 | ecmd->autoneg = AUTONEG_ENABLE; | ||
383 | ecmd->transceiver = XCVR_EXTERNAL; | 382 | ecmd->transceiver = XCVR_EXTERNAL; |
384 | if ((qdev->link_status & STS_LINK_TYPE_MASK) == | 383 | if ((qdev->link_status & STS_LINK_TYPE_MASK) == |
385 | STS_LINK_TYPE_10GBASET) { | 384 | STS_LINK_TYPE_10GBASET) { |
386 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); | 385 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); |
387 | ecmd->advertising |= (ADVERTISED_TP | ADVERTISED_Autoneg); | 386 | ecmd->advertising |= (ADVERTISED_TP | ADVERTISED_Autoneg); |
388 | ecmd->port = PORT_TP; | 387 | ecmd->port = PORT_TP; |
388 | ecmd->autoneg = AUTONEG_ENABLE; | ||
389 | } else { | 389 | } else { |
390 | ecmd->supported |= SUPPORTED_FIBRE; | 390 | ecmd->supported |= SUPPORTED_FIBRE; |
391 | ecmd->advertising |= ADVERTISED_FIBRE; | 391 | ecmd->advertising |= ADVERTISED_FIBRE; |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index b13ab544a7eb..8033555e53c2 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -1434,11 +1434,13 @@ map_error: | |||
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | /* Categorizing receive firmware frame errors */ | 1436 | /* Categorizing receive firmware frame errors */ |
1437 | static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err) | 1437 | static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err, |
1438 | struct rx_ring *rx_ring) | ||
1438 | { | 1439 | { |
1439 | struct nic_stats *stats = &qdev->nic_stats; | 1440 | struct nic_stats *stats = &qdev->nic_stats; |
1440 | 1441 | ||
1441 | stats->rx_err_count++; | 1442 | stats->rx_err_count++; |
1443 | rx_ring->rx_errors++; | ||
1442 | 1444 | ||
1443 | switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { | 1445 | switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { |
1444 | case IB_MAC_IOCB_RSP_ERR_CODE_ERR: | 1446 | case IB_MAC_IOCB_RSP_ERR_CODE_ERR: |
@@ -1474,6 +1476,12 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, | |||
1474 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); | 1476 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); |
1475 | struct napi_struct *napi = &rx_ring->napi; | 1477 | struct napi_struct *napi = &rx_ring->napi; |
1476 | 1478 | ||
1479 | /* Frame error, so drop the packet. */ | ||
1480 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1481 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1482 | put_page(lbq_desc->p.pg_chunk.page); | ||
1483 | return; | ||
1484 | } | ||
1477 | napi->dev = qdev->ndev; | 1485 | napi->dev = qdev->ndev; |
1478 | 1486 | ||
1479 | skb = napi_get_frags(napi); | 1487 | skb = napi_get_frags(napi); |
@@ -1529,6 +1537,12 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, | |||
1529 | addr = lbq_desc->p.pg_chunk.va; | 1537 | addr = lbq_desc->p.pg_chunk.va; |
1530 | prefetch(addr); | 1538 | prefetch(addr); |
1531 | 1539 | ||
1540 | /* Frame error, so drop the packet. */ | ||
1541 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1542 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1543 | goto err_out; | ||
1544 | } | ||
1545 | |||
1532 | /* The max framesize filter on this chip is set higher than | 1546 | /* The max framesize filter on this chip is set higher than |
1533 | * MTU since FCoE uses 2k frames. | 1547 | * MTU since FCoE uses 2k frames. |
1534 | */ | 1548 | */ |
@@ -1614,6 +1628,13 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, | |||
1614 | memcpy(skb_put(new_skb, length), skb->data, length); | 1628 | memcpy(skb_put(new_skb, length), skb->data, length); |
1615 | skb = new_skb; | 1629 | skb = new_skb; |
1616 | 1630 | ||
1631 | /* Frame error, so drop the packet. */ | ||
1632 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1633 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1634 | dev_kfree_skb_any(skb); | ||
1635 | return; | ||
1636 | } | ||
1637 | |||
1617 | /* loopback self test for ethtool */ | 1638 | /* loopback self test for ethtool */ |
1618 | if (test_bit(QL_SELFTEST, &qdev->flags)) { | 1639 | if (test_bit(QL_SELFTEST, &qdev->flags)) { |
1619 | ql_check_lb_frame(qdev, skb); | 1640 | ql_check_lb_frame(qdev, skb); |
@@ -1919,6 +1940,13 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, | |||
1919 | return; | 1940 | return; |
1920 | } | 1941 | } |
1921 | 1942 | ||
1943 | /* Frame error, so drop the packet. */ | ||
1944 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1945 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1946 | dev_kfree_skb_any(skb); | ||
1947 | return; | ||
1948 | } | ||
1949 | |||
1922 | /* The max framesize filter on this chip is set higher than | 1950 | /* The max framesize filter on this chip is set higher than |
1923 | * MTU since FCoE uses 2k frames. | 1951 | * MTU since FCoE uses 2k frames. |
1924 | */ | 1952 | */ |
@@ -2000,12 +2028,6 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, | |||
2000 | 2028 | ||
2001 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); | 2029 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); |
2002 | 2030 | ||
2003 | /* Frame error, so drop the packet. */ | ||
2004 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
2005 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2); | ||
2006 | return (unsigned long)length; | ||
2007 | } | ||
2008 | |||
2009 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { | 2031 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { |
2010 | /* The data and headers are split into | 2032 | /* The data and headers are split into |
2011 | * separate buffers. | 2033 | * separate buffers. |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 28fb50a1e9c3..4ecbe64a758d 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3818,6 +3818,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp) | |||
3818 | } | 3818 | } |
3819 | } | 3819 | } |
3820 | 3820 | ||
3821 | static void rtl_speed_down(struct rtl8169_private *tp) | ||
3822 | { | ||
3823 | u32 adv; | ||
3824 | int lpa; | ||
3825 | |||
3826 | rtl_writephy(tp, 0x1f, 0x0000); | ||
3827 | lpa = rtl_readphy(tp, MII_LPA); | ||
3828 | |||
3829 | if (lpa & (LPA_10HALF | LPA_10FULL)) | ||
3830 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full; | ||
3831 | else if (lpa & (LPA_100HALF | LPA_100FULL)) | ||
3832 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
3833 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | ||
3834 | else | ||
3835 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
3836 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
3837 | (tp->mii.supports_gmii ? | ||
3838 | ADVERTISED_1000baseT_Half | | ||
3839 | ADVERTISED_1000baseT_Full : 0); | ||
3840 | |||
3841 | rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL, | ||
3842 | adv); | ||
3843 | } | ||
3844 | |||
3821 | static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) | 3845 | static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) |
3822 | { | 3846 | { |
3823 | void __iomem *ioaddr = tp->mmio_addr; | 3847 | void __iomem *ioaddr = tp->mmio_addr; |
@@ -3848,9 +3872,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp) | |||
3848 | if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) | 3872 | if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) |
3849 | return false; | 3873 | return false; |
3850 | 3874 | ||
3851 | rtl_writephy(tp, 0x1f, 0x0000); | 3875 | rtl_speed_down(tp); |
3852 | rtl_writephy(tp, MII_BMCR, 0x0000); | ||
3853 | |||
3854 | rtl_wol_suspend_quirk(tp); | 3876 | rtl_wol_suspend_quirk(tp); |
3855 | 3877 | ||
3856 | return true; | 3878 | return true; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 33e96176e4d8..6ed333fe5c04 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) | |||
1216 | if (felic_stat & ECSR_LCHNG) { | 1216 | if (felic_stat & ECSR_LCHNG) { |
1217 | /* Link Changed */ | 1217 | /* Link Changed */ |
1218 | if (mdp->cd->no_psr || mdp->no_ether_link) { | 1218 | if (mdp->cd->no_psr || mdp->no_ether_link) { |
1219 | if (mdp->link == PHY_DOWN) | 1219 | goto ignore_link; |
1220 | link_stat = 0; | ||
1221 | else | ||
1222 | link_stat = PHY_ST_LINK; | ||
1223 | } else { | 1220 | } else { |
1224 | link_stat = (sh_eth_read(ndev, PSR)); | 1221 | link_stat = (sh_eth_read(ndev, PSR)); |
1225 | if (mdp->ether_link_active_low) | 1222 | if (mdp->ether_link_active_low) |
@@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) | |||
1242 | } | 1239 | } |
1243 | } | 1240 | } |
1244 | 1241 | ||
1242 | ignore_link: | ||
1245 | if (intr_status & EESR_TWB) { | 1243 | if (intr_status & EESR_TWB) { |
1246 | /* Write buck end. unused write back interrupt */ | 1244 | /* Write buck end. unused write back interrupt */ |
1247 | if (intr_status & EESR_TABT) /* Transmit Abort int */ | 1245 | if (intr_status & EESR_TABT) /* Transmit Abort int */ |
@@ -1326,12 +1324,18 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1326 | struct sh_eth_private *mdp = netdev_priv(ndev); | 1324 | struct sh_eth_private *mdp = netdev_priv(ndev); |
1327 | struct sh_eth_cpu_data *cd = mdp->cd; | 1325 | struct sh_eth_cpu_data *cd = mdp->cd; |
1328 | irqreturn_t ret = IRQ_NONE; | 1326 | irqreturn_t ret = IRQ_NONE; |
1329 | u32 intr_status = 0; | 1327 | unsigned long intr_status; |
1330 | 1328 | ||
1331 | spin_lock(&mdp->lock); | 1329 | spin_lock(&mdp->lock); |
1332 | 1330 | ||
1333 | /* Get interrpt stat */ | 1331 | /* Get interrupt status */ |
1334 | intr_status = sh_eth_read(ndev, EESR); | 1332 | intr_status = sh_eth_read(ndev, EESR); |
1333 | /* Mask it with the interrupt mask, forcing ECI interrupt to be always | ||
1334 | * enabled since it's the one that comes thru regardless of the mask, | ||
1335 | * and we need to fully handle it in sh_eth_error() in order to quench | ||
1336 | * it as it doesn't get cleared by just writing 1 to the ECI bit... | ||
1337 | */ | ||
1338 | intr_status &= sh_eth_read(ndev, EESIPR) | DMAC_M_ECI; | ||
1335 | /* Clear interrupt */ | 1339 | /* Clear interrupt */ |
1336 | if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | | 1340 | if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | |
1337 | EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | | 1341 | EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | |
@@ -1373,7 +1377,7 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
1373 | struct phy_device *phydev = mdp->phydev; | 1377 | struct phy_device *phydev = mdp->phydev; |
1374 | int new_state = 0; | 1378 | int new_state = 0; |
1375 | 1379 | ||
1376 | if (phydev->link != PHY_DOWN) { | 1380 | if (phydev->link) { |
1377 | if (phydev->duplex != mdp->duplex) { | 1381 | if (phydev->duplex != mdp->duplex) { |
1378 | new_state = 1; | 1382 | new_state = 1; |
1379 | mdp->duplex = phydev->duplex; | 1383 | mdp->duplex = phydev->duplex; |
@@ -1387,17 +1391,21 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
1387 | if (mdp->cd->set_rate) | 1391 | if (mdp->cd->set_rate) |
1388 | mdp->cd->set_rate(ndev); | 1392 | mdp->cd->set_rate(ndev); |
1389 | } | 1393 | } |
1390 | if (mdp->link == PHY_DOWN) { | 1394 | if (!mdp->link) { |
1391 | sh_eth_write(ndev, | 1395 | sh_eth_write(ndev, |
1392 | (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); | 1396 | (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); |
1393 | new_state = 1; | 1397 | new_state = 1; |
1394 | mdp->link = phydev->link; | 1398 | mdp->link = phydev->link; |
1399 | if (mdp->cd->no_psr || mdp->no_ether_link) | ||
1400 | sh_eth_rcv_snd_enable(ndev); | ||
1395 | } | 1401 | } |
1396 | } else if (mdp->link) { | 1402 | } else if (mdp->link) { |
1397 | new_state = 1; | 1403 | new_state = 1; |
1398 | mdp->link = PHY_DOWN; | 1404 | mdp->link = 0; |
1399 | mdp->speed = 0; | 1405 | mdp->speed = 0; |
1400 | mdp->duplex = -1; | 1406 | mdp->duplex = -1; |
1407 | if (mdp->cd->no_psr || mdp->no_ether_link) | ||
1408 | sh_eth_rcv_snd_disable(ndev); | ||
1401 | } | 1409 | } |
1402 | 1410 | ||
1403 | if (new_state && netif_msg_link(mdp)) | 1411 | if (new_state && netif_msg_link(mdp)) |
@@ -1414,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev) | |||
1414 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, | 1422 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, |
1415 | mdp->mii_bus->id , mdp->phy_id); | 1423 | mdp->mii_bus->id , mdp->phy_id); |
1416 | 1424 | ||
1417 | mdp->link = PHY_DOWN; | 1425 | mdp->link = 0; |
1418 | mdp->speed = 0; | 1426 | mdp->speed = 0; |
1419 | mdp->duplex = -1; | 1427 | mdp->duplex = -1; |
1420 | 1428 | ||
@@ -2220,6 +2228,7 @@ static void sh_eth_tsu_init(struct sh_eth_private *mdp) | |||
2220 | /* MDIO bus release function */ | 2228 | /* MDIO bus release function */ |
2221 | static int sh_mdio_release(struct net_device *ndev) | 2229 | static int sh_mdio_release(struct net_device *ndev) |
2222 | { | 2230 | { |
2231 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
2223 | struct mii_bus *bus = dev_get_drvdata(&ndev->dev); | 2232 | struct mii_bus *bus = dev_get_drvdata(&ndev->dev); |
2224 | 2233 | ||
2225 | /* unregister mdio bus */ | 2234 | /* unregister mdio bus */ |
@@ -2234,6 +2243,9 @@ static int sh_mdio_release(struct net_device *ndev) | |||
2234 | /* free bitbang info */ | 2243 | /* free bitbang info */ |
2235 | free_mdio_bitbang(bus); | 2244 | free_mdio_bitbang(bus); |
2236 | 2245 | ||
2246 | /* free bitbang memory */ | ||
2247 | kfree(mdp->bitbang); | ||
2248 | |||
2237 | return 0; | 2249 | return 0; |
2238 | } | 2250 | } |
2239 | 2251 | ||
@@ -2262,6 +2274,7 @@ static int sh_mdio_init(struct net_device *ndev, int id, | |||
2262 | bitbang->ctrl.ops = &bb_ops; | 2274 | bitbang->ctrl.ops = &bb_ops; |
2263 | 2275 | ||
2264 | /* MII controller setting */ | 2276 | /* MII controller setting */ |
2277 | mdp->bitbang = bitbang; | ||
2265 | mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl); | 2278 | mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl); |
2266 | if (!mdp->mii_bus) { | 2279 | if (!mdp->mii_bus) { |
2267 | ret = -ENOMEM; | 2280 | ret = -ENOMEM; |
@@ -2441,6 +2454,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
2441 | } | 2454 | } |
2442 | mdp->tsu_addr = ioremap(rtsu->start, | 2455 | mdp->tsu_addr = ioremap(rtsu->start, |
2443 | resource_size(rtsu)); | 2456 | resource_size(rtsu)); |
2457 | if (mdp->tsu_addr == NULL) { | ||
2458 | ret = -ENOMEM; | ||
2459 | dev_err(&pdev->dev, "TSU ioremap failed.\n"); | ||
2460 | goto out_release; | ||
2461 | } | ||
2444 | mdp->port = devno % 2; | 2462 | mdp->port = devno % 2; |
2445 | ndev->features = NETIF_F_HW_VLAN_FILTER; | 2463 | ndev->features = NETIF_F_HW_VLAN_FILTER; |
2446 | } | 2464 | } |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index bae84fd2e73a..828be4515008 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -705,6 +705,7 @@ struct sh_eth_private { | |||
705 | const u16 *reg_offset; | 705 | const u16 *reg_offset; |
706 | void __iomem *addr; | 706 | void __iomem *addr; |
707 | void __iomem *tsu_addr; | 707 | void __iomem *tsu_addr; |
708 | struct bb_info *bitbang; | ||
708 | u32 num_rx_ring; | 709 | u32 num_rx_ring; |
709 | u32 num_tx_ring; | 710 | u32 num_tx_ring; |
710 | dma_addr_t rx_desc_dma; | 711 | dma_addr_t rx_desc_dma; |
@@ -722,7 +723,7 @@ struct sh_eth_private { | |||
722 | u32 phy_id; /* PHY ID */ | 723 | u32 phy_id; /* PHY ID */ |
723 | struct mii_bus *mii_bus; /* MDIO bus control */ | 724 | struct mii_bus *mii_bus; /* MDIO bus control */ |
724 | struct phy_device *phydev; /* PHY device control */ | 725 | struct phy_device *phydev; /* PHY device control */ |
725 | enum phy_state link; | 726 | int link; |
726 | phy_interface_t phy_interface; | 727 | phy_interface_t phy_interface; |
727 | int msg_enable; | 728 | int msg_enable; |
728 | int speed; | 729 | int speed; |
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index 0ad790cc473c..eaa8e874a3cb 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c | |||
@@ -376,7 +376,8 @@ efx_may_push_tx_desc(struct efx_tx_queue *tx_queue, unsigned int write_count) | |||
376 | return false; | 376 | return false; |
377 | 377 | ||
378 | tx_queue->empty_read_count = 0; | 378 | tx_queue->empty_read_count = 0; |
379 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; | 379 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 |
380 | && tx_queue->write_count - write_count == 1; | ||
380 | } | 381 | } |
381 | 382 | ||
382 | /* For each entry inserted into the software descriptor ring, create a | 383 | /* For each entry inserted into the software descriptor ring, create a |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c index 0c74a702d461..50617c5a0bdb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c | |||
@@ -149,6 +149,7 @@ void dwmac_mmc_intr_all_mask(void __iomem *ioaddr) | |||
149 | { | 149 | { |
150 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_INTR_MASK); | 150 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_INTR_MASK); |
151 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_TX_INTR_MASK); | 151 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_TX_INTR_MASK); |
152 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_IPC_INTR_MASK); | ||
152 | } | 153 | } |
153 | 154 | ||
154 | /* This reads the MAC core counters (if actaully supported). | 155 | /* This reads the MAC core counters (if actaully supported). |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 01ffbc486982..4781d3d8e182 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -436,7 +436,7 @@ void cpsw_tx_handler(void *token, int len, int status) | |||
436 | * queue is stopped then start the queue as we have free desc for tx | 436 | * queue is stopped then start the queue as we have free desc for tx |
437 | */ | 437 | */ |
438 | if (unlikely(netif_queue_stopped(ndev))) | 438 | if (unlikely(netif_queue_stopped(ndev))) |
439 | netif_start_queue(ndev); | 439 | netif_wake_queue(ndev); |
440 | cpts_tx_timestamp(priv->cpts, skb); | 440 | cpts_tx_timestamp(priv->cpts, skb); |
441 | priv->stats.tx_packets++; | 441 | priv->stats.tx_packets++; |
442 | priv->stats.tx_bytes += len; | 442 | priv->stats.tx_bytes += len; |
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, | |||
905 | /* If there is no more tx desc left free then we need to | 905 | /* If there is no more tx desc left free then we need to |
906 | * tell the kernel to stop sending us tx frames. | 906 | * tell the kernel to stop sending us tx frames. |
907 | */ | 907 | */ |
908 | if (unlikely(cpdma_check_free_tx_desc(priv->txch))) | 908 | if (unlikely(!cpdma_check_free_tx_desc(priv->txch))) |
909 | netif_stop_queue(ndev); | 909 | netif_stop_queue(ndev); |
910 | 910 | ||
911 | return NETDEV_TX_OK; | 911 | return NETDEV_TX_OK; |
@@ -1364,7 +1364,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1364 | struct platform_device *mdio; | 1364 | struct platform_device *mdio; |
1365 | 1365 | ||
1366 | parp = of_get_property(slave_node, "phy_id", &lenp); | 1366 | parp = of_get_property(slave_node, "phy_id", &lenp); |
1367 | if ((parp == NULL) && (lenp != (sizeof(void *) * 2))) { | 1367 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
1368 | pr_err("Missing slave[%d] phy_id property\n", i); | 1368 | pr_err("Missing slave[%d] phy_id property\n", i); |
1369 | ret = -EINVAL; | 1369 | ret = -EINVAL; |
1370 | goto error_ret; | 1370 | goto error_ret; |
@@ -1380,7 +1380,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1380 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); | 1380 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); |
1381 | 1381 | ||
1382 | if (data->dual_emac) { | 1382 | if (data->dual_emac) { |
1383 | if (of_property_read_u32(node, "dual_emac_res_vlan", | 1383 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", |
1384 | &prop)) { | 1384 | &prop)) { |
1385 | pr_err("Missing dual_emac_res_vlan in DT.\n"); | 1385 | pr_err("Missing dual_emac_res_vlan in DT.\n"); |
1386 | slave_data->dual_emac_res_vlan = i+1; | 1386 | slave_data->dual_emac_res_vlan = i+1; |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 52c05366599a..72300bc9e378 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1053,7 +1053,7 @@ static void emac_tx_handler(void *token, int len, int status) | |||
1053 | * queue is stopped then start the queue as we have free desc for tx | 1053 | * queue is stopped then start the queue as we have free desc for tx |
1054 | */ | 1054 | */ |
1055 | if (unlikely(netif_queue_stopped(ndev))) | 1055 | if (unlikely(netif_queue_stopped(ndev))) |
1056 | netif_start_queue(ndev); | 1056 | netif_wake_queue(ndev); |
1057 | ndev->stats.tx_packets++; | 1057 | ndev->stats.tx_packets++; |
1058 | ndev->stats.tx_bytes += len; | 1058 | ndev->stats.tx_bytes += len; |
1059 | dev_kfree_skb_any(skb); | 1059 | dev_kfree_skb_any(skb); |
@@ -1102,7 +1102,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1102 | /* If there is no more tx desc left free then we need to | 1102 | /* If there is no more tx desc left free then we need to |
1103 | * tell the kernel to stop sending us tx frames. | 1103 | * tell the kernel to stop sending us tx frames. |
1104 | */ | 1104 | */ |
1105 | if (unlikely(cpdma_check_free_tx_desc(priv->txchan))) | 1105 | if (unlikely(!cpdma_check_free_tx_desc(priv->txchan))) |
1106 | netif_stop_queue(ndev); | 1106 | netif_stop_queue(ndev); |
1107 | 1107 | ||
1108 | return NETDEV_TX_OK; | 1108 | return NETDEV_TX_OK; |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 1cd77483da50..f5f0f09e4cc5 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -470,8 +470,10 @@ static void netvsc_send_completion(struct hv_device *device, | |||
470 | packet->trans_id; | 470 | packet->trans_id; |
471 | 471 | ||
472 | /* Notify the layer above us */ | 472 | /* Notify the layer above us */ |
473 | nvsc_packet->completion.send.send_completion( | 473 | if (nvsc_packet) |
474 | nvsc_packet->completion.send.send_completion_ctx); | 474 | nvsc_packet->completion.send.send_completion( |
475 | nvsc_packet->completion.send. | ||
476 | send_completion_ctx); | ||
475 | 477 | ||
476 | num_outstanding_sends = | 478 | num_outstanding_sends = |
477 | atomic_dec_return(&net_device->num_outstanding_sends); | 479 | atomic_dec_return(&net_device->num_outstanding_sends); |
@@ -498,6 +500,7 @@ int netvsc_send(struct hv_device *device, | |||
498 | int ret = 0; | 500 | int ret = 0; |
499 | struct nvsp_message sendMessage; | 501 | struct nvsp_message sendMessage; |
500 | struct net_device *ndev; | 502 | struct net_device *ndev; |
503 | u64 req_id; | ||
501 | 504 | ||
502 | net_device = get_outbound_net_device(device); | 505 | net_device = get_outbound_net_device(device); |
503 | if (!net_device) | 506 | if (!net_device) |
@@ -518,20 +521,24 @@ int netvsc_send(struct hv_device *device, | |||
518 | 0xFFFFFFFF; | 521 | 0xFFFFFFFF; |
519 | sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; | 522 | sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; |
520 | 523 | ||
524 | if (packet->completion.send.send_completion) | ||
525 | req_id = (u64)packet; | ||
526 | else | ||
527 | req_id = 0; | ||
528 | |||
521 | if (packet->page_buf_cnt) { | 529 | if (packet->page_buf_cnt) { |
522 | ret = vmbus_sendpacket_pagebuffer(device->channel, | 530 | ret = vmbus_sendpacket_pagebuffer(device->channel, |
523 | packet->page_buf, | 531 | packet->page_buf, |
524 | packet->page_buf_cnt, | 532 | packet->page_buf_cnt, |
525 | &sendMessage, | 533 | &sendMessage, |
526 | sizeof(struct nvsp_message), | 534 | sizeof(struct nvsp_message), |
527 | (unsigned long)packet); | 535 | req_id); |
528 | } else { | 536 | } else { |
529 | ret = vmbus_sendpacket(device->channel, &sendMessage, | 537 | ret = vmbus_sendpacket(device->channel, &sendMessage, |
530 | sizeof(struct nvsp_message), | 538 | sizeof(struct nvsp_message), |
531 | (unsigned long)packet, | 539 | req_id, |
532 | VM_PKT_DATA_INBAND, | 540 | VM_PKT_DATA_INBAND, |
533 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 541 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
534 | |||
535 | } | 542 | } |
536 | 543 | ||
537 | if (ret == 0) { | 544 | if (ret == 0) { |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 5f85205cd12b..8341b62e5521 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -241,13 +241,11 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
241 | 241 | ||
242 | if (status == 1) { | 242 | if (status == 1) { |
243 | netif_carrier_on(net); | 243 | netif_carrier_on(net); |
244 | netif_wake_queue(net); | ||
245 | ndev_ctx = netdev_priv(net); | 244 | ndev_ctx = netdev_priv(net); |
246 | schedule_delayed_work(&ndev_ctx->dwork, 0); | 245 | schedule_delayed_work(&ndev_ctx->dwork, 0); |
247 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); | 246 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); |
248 | } else { | 247 | } else { |
249 | netif_carrier_off(net); | 248 | netif_carrier_off(net); |
250 | netif_tx_disable(net); | ||
251 | } | 249 | } |
252 | } | 250 | } |
253 | 251 | ||
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2b657d4d63a8..0775f0aefd1e 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c | |||
@@ -61,9 +61,6 @@ struct rndis_request { | |||
61 | 61 | ||
62 | static void rndis_filter_send_completion(void *ctx); | 62 | static void rndis_filter_send_completion(void *ctx); |
63 | 63 | ||
64 | static void rndis_filter_send_request_completion(void *ctx); | ||
65 | |||
66 | |||
67 | 64 | ||
68 | static struct rndis_device *get_rndis_device(void) | 65 | static struct rndis_device *get_rndis_device(void) |
69 | { | 66 | { |
@@ -241,10 +238,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, | |||
241 | packet->page_buf[0].len; | 238 | packet->page_buf[0].len; |
242 | } | 239 | } |
243 | 240 | ||
244 | packet->completion.send.send_completion_ctx = req;/* packet; */ | 241 | packet->completion.send.send_completion = NULL; |
245 | packet->completion.send.send_completion = | ||
246 | rndis_filter_send_request_completion; | ||
247 | packet->completion.send.send_completion_tid = (unsigned long)dev; | ||
248 | 242 | ||
249 | ret = netvsc_send(dev->net_dev->dev, packet); | 243 | ret = netvsc_send(dev->net_dev->dev, packet); |
250 | return ret; | 244 | return ret; |
@@ -999,9 +993,3 @@ static void rndis_filter_send_completion(void *ctx) | |||
999 | /* Pass it back to the original handler */ | 993 | /* Pass it back to the original handler */ |
1000 | filter_pkt->completion(filter_pkt->completion_ctx); | 994 | filter_pkt->completion(filter_pkt->completion_ctx); |
1001 | } | 995 | } |
1002 | |||
1003 | |||
1004 | static void rndis_filter_send_request_completion(void *ctx) | ||
1005 | { | ||
1006 | /* Noop */ | ||
1007 | } | ||
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 37add21a3d7d..59ac143dec25 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -666,6 +666,7 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
666 | goto done; | 666 | goto done; |
667 | 667 | ||
668 | spin_lock_irqsave(&target_list_lock, flags); | 668 | spin_lock_irqsave(&target_list_lock, flags); |
669 | restart: | ||
669 | list_for_each_entry(nt, &target_list, list) { | 670 | list_for_each_entry(nt, &target_list, list) { |
670 | netconsole_target_get(nt); | 671 | netconsole_target_get(nt); |
671 | if (nt->np.dev == dev) { | 672 | if (nt->np.dev == dev) { |
@@ -678,15 +679,17 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
678 | case NETDEV_UNREGISTER: | 679 | case NETDEV_UNREGISTER: |
679 | /* | 680 | /* |
680 | * rtnl_lock already held | 681 | * rtnl_lock already held |
682 | * we might sleep in __netpoll_cleanup() | ||
681 | */ | 683 | */ |
682 | if (nt->np.dev) { | 684 | spin_unlock_irqrestore(&target_list_lock, flags); |
683 | __netpoll_cleanup(&nt->np); | 685 | __netpoll_cleanup(&nt->np); |
684 | dev_put(nt->np.dev); | 686 | spin_lock_irqsave(&target_list_lock, flags); |
685 | nt->np.dev = NULL; | 687 | dev_put(nt->np.dev); |
686 | } | 688 | nt->np.dev = NULL; |
687 | nt->enabled = 0; | 689 | nt->enabled = 0; |
688 | stopped = true; | 690 | stopped = true; |
689 | break; | 691 | netconsole_target_put(nt); |
692 | goto restart; | ||
690 | } | 693 | } |
691 | } | 694 | } |
692 | netconsole_target_put(nt); | 695 | netconsole_target_put(nt); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index b7c457adc0dc..729ed533bb33 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1594,7 +1594,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1594 | 1594 | ||
1595 | if (tun->flags & TUN_TAP_MQ && | 1595 | if (tun->flags & TUN_TAP_MQ && |
1596 | (tun->numqueues + tun->numdisabled > 1)) | 1596 | (tun->numqueues + tun->numdisabled > 1)) |
1597 | return err; | 1597 | return -EBUSY; |
1598 | } | 1598 | } |
1599 | else { | 1599 | else { |
1600 | char *name; | 1600 | char *name; |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3b6e9b83342d..7c769d8e25ad 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -268,7 +268,7 @@ config USB_NET_SMSC75XX | |||
268 | select CRC16 | 268 | select CRC16 |
269 | select CRC32 | 269 | select CRC32 |
270 | help | 270 | help |
271 | This option adds support for SMSC LAN95XX based USB 2.0 | 271 | This option adds support for SMSC LAN75XX based USB 2.0 |
272 | Gigabit Ethernet adapters. | 272 | Gigabit Ethernet adapters. |
273 | 273 | ||
274 | config USB_NET_SMSC95XX | 274 | config USB_NET_SMSC95XX |
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 248d2dc765a5..6bd91676d2cb 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
@@ -68,18 +68,9 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) | |||
68 | struct cdc_ncm_ctx *ctx; | 68 | struct cdc_ncm_ctx *ctx; |
69 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); | 69 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); |
70 | int ret = -ENODEV; | 70 | int ret = -ENODEV; |
71 | u8 data_altsetting = CDC_NCM_DATA_ALTSETTING_NCM; | 71 | u8 data_altsetting = cdc_ncm_select_altsetting(dev, intf); |
72 | struct cdc_mbim_state *info = (void *)&dev->data; | 72 | struct cdc_mbim_state *info = (void *)&dev->data; |
73 | 73 | ||
74 | /* see if interface supports MBIM alternate setting */ | ||
75 | if (intf->num_altsetting == 2) { | ||
76 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | ||
77 | usb_set_interface(dev->udev, | ||
78 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
79 | CDC_NCM_COMM_ALTSETTING_MBIM); | ||
80 | data_altsetting = CDC_NCM_DATA_ALTSETTING_MBIM; | ||
81 | } | ||
82 | |||
83 | /* Probably NCM, defer for cdc_ncm_bind */ | 74 | /* Probably NCM, defer for cdc_ncm_bind */ |
84 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 75 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
85 | goto err; | 76 | goto err; |
@@ -143,7 +134,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb | |||
143 | goto error; | 134 | goto error; |
144 | 135 | ||
145 | if (skb) { | 136 | if (skb) { |
146 | if (skb->len <= sizeof(ETH_HLEN)) | 137 | if (skb->len <= ETH_HLEN) |
147 | goto error; | 138 | goto error; |
148 | 139 | ||
149 | /* mapping VLANs to MBIM sessions: | 140 | /* mapping VLANs to MBIM sessions: |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 61b74a2b89ac..4709fa3497cf 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -55,6 +55,14 @@ | |||
55 | 55 | ||
56 | #define DRIVER_VERSION "14-Mar-2012" | 56 | #define DRIVER_VERSION "14-Mar-2012" |
57 | 57 | ||
58 | #if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) | ||
59 | static bool prefer_mbim = true; | ||
60 | #else | ||
61 | static bool prefer_mbim; | ||
62 | #endif | ||
63 | module_param(prefer_mbim, bool, S_IRUGO | S_IWUSR); | ||
64 | MODULE_PARM_DESC(prefer_mbim, "Prefer MBIM setting on dual NCM/MBIM functions"); | ||
65 | |||
58 | static void cdc_ncm_txpath_bh(unsigned long param); | 66 | static void cdc_ncm_txpath_bh(unsigned long param); |
59 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); | 67 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); |
60 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); | 68 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); |
@@ -550,9 +558,12 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
550 | } | 558 | } |
551 | EXPORT_SYMBOL_GPL(cdc_ncm_unbind); | 559 | EXPORT_SYMBOL_GPL(cdc_ncm_unbind); |
552 | 560 | ||
553 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | 561 | /* Select the MBIM altsetting iff it is preferred and available, |
562 | * returning the number of the corresponding data interface altsetting | ||
563 | */ | ||
564 | u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf) | ||
554 | { | 565 | { |
555 | int ret; | 566 | struct usb_host_interface *alt; |
556 | 567 | ||
557 | /* The MBIM spec defines a NCM compatible default altsetting, | 568 | /* The MBIM spec defines a NCM compatible default altsetting, |
558 | * which we may have matched: | 569 | * which we may have matched: |
@@ -568,23 +579,27 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | |||
568 | * endpoint descriptors, shall be constructed according to | 579 | * endpoint descriptors, shall be constructed according to |
569 | * the rules given in section 6 (USB Device Model) of this | 580 | * the rules given in section 6 (USB Device Model) of this |
570 | * specification." | 581 | * specification." |
571 | * | ||
572 | * Do not bind to such interfaces, allowing cdc_mbim to handle | ||
573 | * them | ||
574 | */ | 582 | */ |
575 | #if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) | 583 | if (prefer_mbim && intf->num_altsetting == 2) { |
576 | if ((intf->num_altsetting == 2) && | 584 | alt = usb_altnum_to_altsetting(intf, CDC_NCM_COMM_ALTSETTING_MBIM); |
577 | !usb_set_interface(dev->udev, | 585 | if (alt && cdc_ncm_comm_intf_is_mbim(alt) && |
578 | intf->cur_altsetting->desc.bInterfaceNumber, | 586 | !usb_set_interface(dev->udev, |
579 | CDC_NCM_COMM_ALTSETTING_MBIM)) { | 587 | intf->cur_altsetting->desc.bInterfaceNumber, |
580 | if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 588 | CDC_NCM_COMM_ALTSETTING_MBIM)) |
581 | return -ENODEV; | 589 | return CDC_NCM_DATA_ALTSETTING_MBIM; |
582 | else | ||
583 | usb_set_interface(dev->udev, | ||
584 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
585 | CDC_NCM_COMM_ALTSETTING_NCM); | ||
586 | } | 590 | } |
587 | #endif | 591 | return CDC_NCM_DATA_ALTSETTING_NCM; |
592 | } | ||
593 | EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting); | ||
594 | |||
595 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | ||
596 | { | ||
597 | int ret; | ||
598 | |||
599 | /* MBIM backwards compatible function? */ | ||
600 | cdc_ncm_select_altsetting(dev, intf); | ||
601 | if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | ||
602 | return -ENODEV; | ||
588 | 603 | ||
589 | /* NCM data altsetting is always 1 */ | 604 | /* NCM data altsetting is always 1 */ |
590 | ret = cdc_ncm_bind_common(dev, intf, 1); | 605 | ret = cdc_ncm_bind_common(dev, intf, 1); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index efb5c7c33a28..2a3579f67910 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/ethtool.h> | 15 | #include <linux/ethtool.h> |
16 | #include <linux/etherdevice.h> | ||
16 | #include <linux/mii.h> | 17 | #include <linux/mii.h> |
17 | #include <linux/usb.h> | 18 | #include <linux/usb.h> |
18 | #include <linux/usb/cdc.h> | 19 | #include <linux/usb/cdc.h> |
@@ -52,6 +53,96 @@ struct qmi_wwan_state { | |||
52 | struct usb_interface *data; | 53 | struct usb_interface *data; |
53 | }; | 54 | }; |
54 | 55 | ||
56 | /* default ethernet address used by the modem */ | ||
57 | static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; | ||
58 | |||
59 | /* Make up an ethernet header if the packet doesn't have one. | ||
60 | * | ||
61 | * A firmware bug common among several devices cause them to send raw | ||
62 | * IP packets under some circumstances. There is no way for the | ||
63 | * driver/host to know when this will happen. And even when the bug | ||
64 | * hits, some packets will still arrive with an intact header. | ||
65 | * | ||
66 | * The supported devices are only capably of sending IPv4, IPv6 and | ||
67 | * ARP packets on a point-to-point link. Any packet with an ethernet | ||
68 | * header will have either our address or a broadcast/multicast | ||
69 | * address as destination. ARP packets will always have a header. | ||
70 | * | ||
71 | * This means that this function will reliably add the appropriate | ||
72 | * header iff necessary, provided our hardware address does not start | ||
73 | * with 4 or 6. | ||
74 | * | ||
75 | * Another common firmware bug results in all packets being addressed | ||
76 | * to 00:a0:c6:00:00:00 despite the host address being different. | ||
77 | * This function will also fixup such packets. | ||
78 | */ | ||
79 | static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
80 | { | ||
81 | __be16 proto; | ||
82 | |||
83 | /* usbnet rx_complete guarantees that skb->len is at least | ||
84 | * hard_header_len, so we can inspect the dest address without | ||
85 | * checking skb->len | ||
86 | */ | ||
87 | switch (skb->data[0] & 0xf0) { | ||
88 | case 0x40: | ||
89 | proto = htons(ETH_P_IP); | ||
90 | break; | ||
91 | case 0x60: | ||
92 | proto = htons(ETH_P_IPV6); | ||
93 | break; | ||
94 | case 0x00: | ||
95 | if (is_multicast_ether_addr(skb->data)) | ||
96 | return 1; | ||
97 | /* possibly bogus destination - rewrite just in case */ | ||
98 | skb_reset_mac_header(skb); | ||
99 | goto fix_dest; | ||
100 | default: | ||
101 | /* pass along other packets without modifications */ | ||
102 | return 1; | ||
103 | } | ||
104 | if (skb_headroom(skb) < ETH_HLEN) | ||
105 | return 0; | ||
106 | skb_push(skb, ETH_HLEN); | ||
107 | skb_reset_mac_header(skb); | ||
108 | eth_hdr(skb)->h_proto = proto; | ||
109 | memset(eth_hdr(skb)->h_source, 0, ETH_ALEN); | ||
110 | fix_dest: | ||
111 | memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN); | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | /* very simplistic detection of IPv4 or IPv6 headers */ | ||
116 | static bool possibly_iphdr(const char *data) | ||
117 | { | ||
118 | return (data[0] & 0xd0) == 0x40; | ||
119 | } | ||
120 | |||
121 | /* disallow addresses which may be confused with IP headers */ | ||
122 | static int qmi_wwan_mac_addr(struct net_device *dev, void *p) | ||
123 | { | ||
124 | int ret; | ||
125 | struct sockaddr *addr = p; | ||
126 | |||
127 | ret = eth_prepare_mac_addr_change(dev, p); | ||
128 | if (ret < 0) | ||
129 | return ret; | ||
130 | if (possibly_iphdr(addr->sa_data)) | ||
131 | return -EADDRNOTAVAIL; | ||
132 | eth_commit_mac_addr_change(dev, p); | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static const struct net_device_ops qmi_wwan_netdev_ops = { | ||
137 | .ndo_open = usbnet_open, | ||
138 | .ndo_stop = usbnet_stop, | ||
139 | .ndo_start_xmit = usbnet_start_xmit, | ||
140 | .ndo_tx_timeout = usbnet_tx_timeout, | ||
141 | .ndo_change_mtu = usbnet_change_mtu, | ||
142 | .ndo_set_mac_address = qmi_wwan_mac_addr, | ||
143 | .ndo_validate_addr = eth_validate_addr, | ||
144 | }; | ||
145 | |||
55 | /* using a counter to merge subdriver requests with our own into a combined state */ | 146 | /* using a counter to merge subdriver requests with our own into a combined state */ |
56 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) | 147 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
57 | { | 148 | { |
@@ -139,16 +230,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
139 | 230 | ||
140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | 231 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); |
141 | 232 | ||
142 | /* control and data is shared? */ | 233 | /* set up initial state */ |
143 | if (intf->cur_altsetting->desc.bNumEndpoints == 3) { | 234 | info->control = intf; |
144 | info->control = intf; | 235 | info->data = intf; |
145 | info->data = intf; | ||
146 | goto shared; | ||
147 | } | ||
148 | |||
149 | /* else require a single interrupt status endpoint on control intf */ | ||
150 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) | ||
151 | goto err; | ||
152 | 236 | ||
153 | /* and a number of CDC descriptors */ | 237 | /* and a number of CDC descriptors */ |
154 | while (len > 3) { | 238 | while (len > 3) { |
@@ -207,25 +291,14 @@ next_desc: | |||
207 | buf += h->bLength; | 291 | buf += h->bLength; |
208 | } | 292 | } |
209 | 293 | ||
210 | /* did we find all the required ones? */ | 294 | /* Use separate control and data interfaces if we found a CDC Union */ |
211 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || | 295 | if (cdc_union) { |
212 | !(found & (1 << USB_CDC_UNION_TYPE))) { | 296 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); |
213 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); | 297 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) { |
214 | goto err; | 298 | dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n", |
215 | } | 299 | cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0); |
216 | 300 | goto err; | |
217 | /* verify CDC Union */ | 301 | } |
218 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) { | ||
219 | dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0); | ||
220 | goto err; | ||
221 | } | ||
222 | |||
223 | /* need to save these for unbind */ | ||
224 | info->control = intf; | ||
225 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); | ||
226 | if (!info->data) { | ||
227 | dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0); | ||
228 | goto err; | ||
229 | } | 302 | } |
230 | 303 | ||
231 | /* errors aren't fatal - we can live with the dynamic address */ | 304 | /* errors aren't fatal - we can live with the dynamic address */ |
@@ -235,17 +308,30 @@ next_desc: | |||
235 | } | 308 | } |
236 | 309 | ||
237 | /* claim data interface and set it up */ | 310 | /* claim data interface and set it up */ |
238 | status = usb_driver_claim_interface(driver, info->data, dev); | 311 | if (info->control != info->data) { |
239 | if (status < 0) | 312 | status = usb_driver_claim_interface(driver, info->data, dev); |
240 | goto err; | 313 | if (status < 0) |
314 | goto err; | ||
315 | } | ||
241 | 316 | ||
242 | shared: | ||
243 | status = qmi_wwan_register_subdriver(dev); | 317 | status = qmi_wwan_register_subdriver(dev); |
244 | if (status < 0 && info->control != info->data) { | 318 | if (status < 0 && info->control != info->data) { |
245 | usb_set_intfdata(info->data, NULL); | 319 | usb_set_intfdata(info->data, NULL); |
246 | usb_driver_release_interface(driver, info->data); | 320 | usb_driver_release_interface(driver, info->data); |
247 | } | 321 | } |
248 | 322 | ||
323 | /* Never use the same address on both ends of the link, even | ||
324 | * if the buggy firmware told us to. | ||
325 | */ | ||
326 | if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr)) | ||
327 | eth_hw_addr_random(dev->net); | ||
328 | |||
329 | /* make MAC addr easily distinguishable from an IP header */ | ||
330 | if (possibly_iphdr(dev->net->dev_addr)) { | ||
331 | dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */ | ||
332 | dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */ | ||
333 | } | ||
334 | dev->net->netdev_ops = &qmi_wwan_netdev_ops; | ||
249 | err: | 335 | err: |
250 | return status; | 336 | return status; |
251 | } | 337 | } |
@@ -324,6 +410,7 @@ static const struct driver_info qmi_wwan_info = { | |||
324 | .bind = qmi_wwan_bind, | 410 | .bind = qmi_wwan_bind, |
325 | .unbind = qmi_wwan_unbind, | 411 | .unbind = qmi_wwan_unbind, |
326 | .manage_power = qmi_wwan_manage_power, | 412 | .manage_power = qmi_wwan_manage_power, |
413 | .rx_fixup = qmi_wwan_rx_fixup, | ||
327 | }; | 414 | }; |
328 | 415 | ||
329 | #define HUAWEI_VENDOR_ID 0x12D1 | 416 | #define HUAWEI_VENDOR_ID 0x12D1 |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 9abe51710f22..1a15ec14c386 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -914,8 +914,12 @@ static int smsc75xx_set_rx_max_frame_length(struct usbnet *dev, int size) | |||
914 | static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) | 914 | static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) |
915 | { | 915 | { |
916 | struct usbnet *dev = netdev_priv(netdev); | 916 | struct usbnet *dev = netdev_priv(netdev); |
917 | int ret; | ||
918 | |||
919 | if (new_mtu > MAX_SINGLE_PACKET_SIZE) | ||
920 | return -EINVAL; | ||
917 | 921 | ||
918 | int ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu); | 922 | ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN); |
919 | if (ret < 0) { | 923 | if (ret < 0) { |
920 | netdev_warn(dev->net, "Failed to set mac rx frame length\n"); | 924 | netdev_warn(dev->net, "Failed to set mac rx frame length\n"); |
921 | return ret; | 925 | return ret; |
@@ -1324,7 +1328,7 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
1324 | 1328 | ||
1325 | netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); | 1329 | netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); |
1326 | 1330 | ||
1327 | ret = smsc75xx_set_rx_max_frame_length(dev, 1514); | 1331 | ret = smsc75xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN); |
1328 | if (ret < 0) { | 1332 | if (ret < 0) { |
1329 | netdev_warn(dev->net, "Failed to set max rx frame length\n"); | 1333 | netdev_warn(dev->net, "Failed to set max rx frame length\n"); |
1330 | return ret; | 1334 | return ret; |
@@ -2134,8 +2138,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
2134 | else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) | 2138 | else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) |
2135 | dev->net->stats.rx_frame_errors++; | 2139 | dev->net->stats.rx_frame_errors++; |
2136 | } else { | 2140 | } else { |
2137 | /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ | 2141 | /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */ |
2138 | if (unlikely(size > (ETH_FRAME_LEN + 12))) { | 2142 | if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) { |
2139 | netif_dbg(dev, rx_err, dev->net, | 2143 | netif_dbg(dev, rx_err, dev->net, |
2140 | "size err rx_cmd_a=0x%08x\n", | 2144 | "size err rx_cmd_a=0x%08x\n", |
2141 | rx_cmd_a); | 2145 | rx_cmd_a); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 4cc13940c895..f76c3ca07a45 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -1023,6 +1023,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
1023 | AR_PHY_AGC_CONTROL_FLTR_CAL | | 1023 | AR_PHY_AGC_CONTROL_FLTR_CAL | |
1024 | AR_PHY_AGC_CONTROL_PKDET_CAL; | 1024 | AR_PHY_AGC_CONTROL_PKDET_CAL; |
1025 | 1025 | ||
1026 | /* Use chip chainmask only for calibration */ | ||
1026 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); | 1027 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); |
1027 | 1028 | ||
1028 | if (rtt) { | 1029 | if (rtt) { |
@@ -1150,6 +1151,9 @@ skip_tx_iqcal: | |||
1150 | ar9003_hw_rtt_disable(ah); | 1151 | ar9003_hw_rtt_disable(ah); |
1151 | } | 1152 | } |
1152 | 1153 | ||
1154 | /* Revert chainmask to runtime parameters */ | ||
1155 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | ||
1156 | |||
1153 | /* Initialize list pointers */ | 1157 | /* Initialize list pointers */ |
1154 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; | 1158 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
1155 | 1159 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h index 28fd99203f64..bdee2ed67219 100644 --- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h | |||
@@ -519,7 +519,7 @@ static const u32 ar9580_1p0_mac_core[][2] = { | |||
519 | {0x00008258, 0x00000000}, | 519 | {0x00008258, 0x00000000}, |
520 | {0x0000825c, 0x40000000}, | 520 | {0x0000825c, 0x40000000}, |
521 | {0x00008260, 0x00080922}, | 521 | {0x00008260, 0x00080922}, |
522 | {0x00008264, 0x9bc00010}, | 522 | {0x00008264, 0x9d400010}, |
523 | {0x00008268, 0xffffffff}, | 523 | {0x00008268, 0xffffffff}, |
524 | {0x0000826c, 0x0000ffff}, | 524 | {0x0000826c, 0x0000ffff}, |
525 | {0x00008270, 0x00000000}, | 525 | {0x00008270, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c index 467b60014b7b..73fe8d6db566 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c | |||
@@ -143,14 +143,14 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) | |||
143 | u32 sz, i; | 143 | u32 sz, i; |
144 | struct channel_detector *cd; | 144 | struct channel_detector *cd; |
145 | 145 | ||
146 | cd = kmalloc(sizeof(*cd), GFP_KERNEL); | 146 | cd = kmalloc(sizeof(*cd), GFP_ATOMIC); |
147 | if (cd == NULL) | 147 | if (cd == NULL) |
148 | goto fail; | 148 | goto fail; |
149 | 149 | ||
150 | INIT_LIST_HEAD(&cd->head); | 150 | INIT_LIST_HEAD(&cd->head); |
151 | cd->freq = freq; | 151 | cd->freq = freq; |
152 | sz = sizeof(cd->detectors) * dpd->num_radar_types; | 152 | sz = sizeof(cd->detectors) * dpd->num_radar_types; |
153 | cd->detectors = kzalloc(sz, GFP_KERNEL); | 153 | cd->detectors = kzalloc(sz, GFP_ATOMIC); |
154 | if (cd->detectors == NULL) | 154 | if (cd->detectors == NULL) |
155 | goto fail; | 155 | goto fail; |
156 | 156 | ||
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c index 91b8dceeadb1..5e48c5515b8c 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c | |||
@@ -218,7 +218,7 @@ static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) | |||
218 | { | 218 | { |
219 | struct pulse_elem *p = pool_get_pulse_elem(); | 219 | struct pulse_elem *p = pool_get_pulse_elem(); |
220 | if (p == NULL) { | 220 | if (p == NULL) { |
221 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 221 | p = kmalloc(sizeof(*p), GFP_ATOMIC); |
222 | if (p == NULL) { | 222 | if (p == NULL) { |
223 | DFS_POOL_STAT_INC(pulse_alloc_error); | 223 | DFS_POOL_STAT_INC(pulse_alloc_error); |
224 | return false; | 224 | return false; |
@@ -299,7 +299,7 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde, | |||
299 | ps.deadline_ts = ps.first_ts + ps.dur; | 299 | ps.deadline_ts = ps.first_ts + ps.dur; |
300 | new_ps = pool_get_pseq_elem(); | 300 | new_ps = pool_get_pseq_elem(); |
301 | if (new_ps == NULL) { | 301 | if (new_ps == NULL) { |
302 | new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL); | 302 | new_ps = kmalloc(sizeof(*new_ps), GFP_ATOMIC); |
303 | if (new_ps == NULL) { | 303 | if (new_ps == NULL) { |
304 | DFS_POOL_STAT_INC(pseq_alloc_error); | 304 | DFS_POOL_STAT_INC(pseq_alloc_error); |
305 | return false; | 305 | return false; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 716058b67557..a47f5e05fc04 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -796,7 +796,7 @@ static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv) | |||
796 | * required version. | 796 | * required version. |
797 | */ | 797 | */ |
798 | if (priv->fw_version_major != MAJOR_VERSION_REQ || | 798 | if (priv->fw_version_major != MAJOR_VERSION_REQ || |
799 | priv->fw_version_minor != MINOR_VERSION_REQ) { | 799 | priv->fw_version_minor < MINOR_VERSION_REQ) { |
800 | dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", | 800 | dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", |
801 | MAJOR_VERSION_REQ, MINOR_VERSION_REQ); | 801 | MAJOR_VERSION_REQ, MINOR_VERSION_REQ); |
802 | return -EINVAL; | 802 | return -EINVAL; |
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index ade3afb21f91..7fdac6c7b3ea 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -28,21 +28,21 @@ void ath_tx_complete_poll_work(struct work_struct *work) | |||
28 | int i; | 28 | int i; |
29 | bool needreset = false; | 29 | bool needreset = false; |
30 | 30 | ||
31 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) | 31 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
32 | if (ATH_TXQ_SETUP(sc, i)) { | 32 | txq = sc->tx.txq_map[i]; |
33 | txq = &sc->tx.txq[i]; | 33 | |
34 | ath_txq_lock(sc, txq); | 34 | ath_txq_lock(sc, txq); |
35 | if (txq->axq_depth) { | 35 | if (txq->axq_depth) { |
36 | if (txq->axq_tx_inprogress) { | 36 | if (txq->axq_tx_inprogress) { |
37 | needreset = true; | 37 | needreset = true; |
38 | ath_txq_unlock(sc, txq); | 38 | ath_txq_unlock(sc, txq); |
39 | break; | 39 | break; |
40 | } else { | 40 | } else { |
41 | txq->axq_tx_inprogress = true; | 41 | txq->axq_tx_inprogress = true; |
42 | } | ||
43 | } | 42 | } |
44 | ath_txq_unlock_complete(sc, txq); | ||
45 | } | 43 | } |
44 | ath_txq_unlock_complete(sc, txq); | ||
45 | } | ||
46 | 46 | ||
47 | if (needreset) { | 47 | if (needreset) { |
48 | ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, | 48 | ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, |
@@ -170,7 +170,8 @@ void ath_rx_poll(unsigned long data) | |||
170 | { | 170 | { |
171 | struct ath_softc *sc = (struct ath_softc *)data; | 171 | struct ath_softc *sc = (struct ath_softc *)data; |
172 | 172 | ||
173 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | 173 | if (!test_bit(SC_OP_INVALID, &sc->sc_flags)) |
174 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | ||
174 | } | 175 | } |
175 | 176 | ||
176 | /* | 177 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6e66f9c6782b..988372d218a4 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -280,6 +280,10 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) | |||
280 | if (r) { | 280 | if (r) { |
281 | ath_err(common, | 281 | ath_err(common, |
282 | "Unable to reset channel, reset status %d\n", r); | 282 | "Unable to reset channel, reset status %d\n", r); |
283 | |||
284 | ath9k_hw_enable_interrupts(ah); | ||
285 | ath9k_queue_reset(sc, RESET_TYPE_BB_HANG); | ||
286 | |||
283 | goto out; | 287 | goto out; |
284 | } | 288 | } |
285 | 289 | ||
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 38bc5a7997ff..122146943bf2 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -1487,8 +1487,12 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1487 | const struct b43_dma_ops *ops; | 1487 | const struct b43_dma_ops *ops; |
1488 | struct b43_dmaring *ring; | 1488 | struct b43_dmaring *ring; |
1489 | struct b43_dmadesc_meta *meta; | 1489 | struct b43_dmadesc_meta *meta; |
1490 | static const struct b43_txstatus fake; /* filled with 0 */ | ||
1491 | const struct b43_txstatus *txstat; | ||
1490 | int slot, firstused; | 1492 | int slot, firstused; |
1491 | bool frame_succeed; | 1493 | bool frame_succeed; |
1494 | int skip; | ||
1495 | static u8 err_out1, err_out2; | ||
1492 | 1496 | ||
1493 | ring = parse_cookie(dev, status->cookie, &slot); | 1497 | ring = parse_cookie(dev, status->cookie, &slot); |
1494 | if (unlikely(!ring)) | 1498 | if (unlikely(!ring)) |
@@ -1501,13 +1505,36 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1501 | firstused = ring->current_slot - ring->used_slots + 1; | 1505 | firstused = ring->current_slot - ring->used_slots + 1; |
1502 | if (firstused < 0) | 1506 | if (firstused < 0) |
1503 | firstused = ring->nr_slots + firstused; | 1507 | firstused = ring->nr_slots + firstused; |
1508 | |||
1509 | skip = 0; | ||
1504 | if (unlikely(slot != firstused)) { | 1510 | if (unlikely(slot != firstused)) { |
1505 | /* This possibly is a firmware bug and will result in | 1511 | /* This possibly is a firmware bug and will result in |
1506 | * malfunction, memory leaks and/or stall of DMA functionality. */ | 1512 | * malfunction, memory leaks and/or stall of DMA functionality. |
1507 | b43dbg(dev->wl, "Out of order TX status report on DMA ring %d. " | 1513 | */ |
1508 | "Expected %d, but got %d\n", | 1514 | if (slot == next_slot(ring, next_slot(ring, firstused))) { |
1509 | ring->index, firstused, slot); | 1515 | /* If a single header/data pair was missed, skip over |
1510 | return; | 1516 | * the first two slots in an attempt to recover. |
1517 | */ | ||
1518 | slot = firstused; | ||
1519 | skip = 2; | ||
1520 | if (!err_out1) { | ||
1521 | /* Report the error once. */ | ||
1522 | b43dbg(dev->wl, | ||
1523 | "Skip on DMA ring %d slot %d.\n", | ||
1524 | ring->index, slot); | ||
1525 | err_out1 = 1; | ||
1526 | } | ||
1527 | } else { | ||
1528 | /* More than a single header/data pair were missed. | ||
1529 | * Report this error once. | ||
1530 | */ | ||
1531 | if (!err_out2) | ||
1532 | b43dbg(dev->wl, | ||
1533 | "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", | ||
1534 | ring->index, firstused, slot); | ||
1535 | err_out2 = 1; | ||
1536 | return; | ||
1537 | } | ||
1511 | } | 1538 | } |
1512 | 1539 | ||
1513 | ops = ring->ops; | 1540 | ops = ring->ops; |
@@ -1522,11 +1549,13 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1522 | slot, firstused, ring->index); | 1549 | slot, firstused, ring->index); |
1523 | break; | 1550 | break; |
1524 | } | 1551 | } |
1552 | |||
1525 | if (meta->skb) { | 1553 | if (meta->skb) { |
1526 | struct b43_private_tx_info *priv_info = | 1554 | struct b43_private_tx_info *priv_info = |
1527 | b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); | 1555 | b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); |
1528 | 1556 | ||
1529 | unmap_descbuffer(ring, meta->dmaaddr, meta->skb->len, 1); | 1557 | unmap_descbuffer(ring, meta->dmaaddr, |
1558 | meta->skb->len, 1); | ||
1530 | kfree(priv_info->bouncebuffer); | 1559 | kfree(priv_info->bouncebuffer); |
1531 | priv_info->bouncebuffer = NULL; | 1560 | priv_info->bouncebuffer = NULL; |
1532 | } else { | 1561 | } else { |
@@ -1538,8 +1567,9 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1538 | struct ieee80211_tx_info *info; | 1567 | struct ieee80211_tx_info *info; |
1539 | 1568 | ||
1540 | if (unlikely(!meta->skb)) { | 1569 | if (unlikely(!meta->skb)) { |
1541 | /* This is a scatter-gather fragment of a frame, so | 1570 | /* This is a scatter-gather fragment of a frame, |
1542 | * the skb pointer must not be NULL. */ | 1571 | * so the skb pointer must not be NULL. |
1572 | */ | ||
1543 | b43dbg(dev->wl, "TX status unexpected NULL skb " | 1573 | b43dbg(dev->wl, "TX status unexpected NULL skb " |
1544 | "at slot %d (first=%d) on ring %d\n", | 1574 | "at slot %d (first=%d) on ring %d\n", |
1545 | slot, firstused, ring->index); | 1575 | slot, firstused, ring->index); |
@@ -1550,9 +1580,18 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1550 | 1580 | ||
1551 | /* | 1581 | /* |
1552 | * Call back to inform the ieee80211 subsystem about | 1582 | * Call back to inform the ieee80211 subsystem about |
1553 | * the status of the transmission. | 1583 | * the status of the transmission. When skipping over |
1584 | * a missed TX status report, use a status structure | ||
1585 | * filled with zeros to indicate that the frame was not | ||
1586 | * sent (frame_count 0) and not acknowledged | ||
1554 | */ | 1587 | */ |
1555 | frame_succeed = b43_fill_txstatus_report(dev, info, status); | 1588 | if (unlikely(skip)) |
1589 | txstat = &fake; | ||
1590 | else | ||
1591 | txstat = status; | ||
1592 | |||
1593 | frame_succeed = b43_fill_txstatus_report(dev, info, | ||
1594 | txstat); | ||
1556 | #ifdef CONFIG_B43_DEBUG | 1595 | #ifdef CONFIG_B43_DEBUG |
1557 | if (frame_succeed) | 1596 | if (frame_succeed) |
1558 | ring->nr_succeed_tx_packets++; | 1597 | ring->nr_succeed_tx_packets++; |
@@ -1580,12 +1619,14 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1580 | /* Everything unmapped and free'd. So it's not used anymore. */ | 1619 | /* Everything unmapped and free'd. So it's not used anymore. */ |
1581 | ring->used_slots--; | 1620 | ring->used_slots--; |
1582 | 1621 | ||
1583 | if (meta->is_last_fragment) { | 1622 | if (meta->is_last_fragment && !skip) { |
1584 | /* This is the last scatter-gather | 1623 | /* This is the last scatter-gather |
1585 | * fragment of the frame. We are done. */ | 1624 | * fragment of the frame. We are done. */ |
1586 | break; | 1625 | break; |
1587 | } | 1626 | } |
1588 | slot = next_slot(ring, slot); | 1627 | slot = next_slot(ring, slot); |
1628 | if (skip > 0) | ||
1629 | --skip; | ||
1589 | } | 1630 | } |
1590 | if (ring->stopped) { | 1631 | if (ring->stopped) { |
1591 | B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); | 1632 | B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); |
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 3c35382ee6c2..b70f220bc4b3 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -1564,7 +1564,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1564 | u16 clip_off[2] = { 0xFFFF, 0xFFFF }; | 1564 | u16 clip_off[2] = { 0xFFFF, 0xFFFF }; |
1565 | 1565 | ||
1566 | u8 vcm_final = 0; | 1566 | u8 vcm_final = 0; |
1567 | s8 offset[4]; | 1567 | s32 offset[4]; |
1568 | s32 results[8][4] = { }; | 1568 | s32 results[8][4] = { }; |
1569 | s32 results_min[4] = { }; | 1569 | s32 results_min[4] = { }; |
1570 | s32 poll_results[4] = { }; | 1570 | s32 poll_results[4] = { }; |
@@ -1615,7 +1615,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1615 | } | 1615 | } |
1616 | for (i = 0; i < 4; i += 2) { | 1616 | for (i = 0; i < 4; i += 2) { |
1617 | s32 curr; | 1617 | s32 curr; |
1618 | s32 mind = 40; | 1618 | s32 mind = 0x100000; |
1619 | s32 minpoll = 249; | 1619 | s32 minpoll = 249; |
1620 | u8 minvcm = 0; | 1620 | u8 minvcm = 0; |
1621 | if (2 * core != i) | 1621 | if (2 * core != i) |
@@ -1732,7 +1732,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) | |||
1732 | u8 regs_save_radio[2]; | 1732 | u8 regs_save_radio[2]; |
1733 | u16 regs_save_phy[2]; | 1733 | u16 regs_save_phy[2]; |
1734 | 1734 | ||
1735 | s8 offset[4]; | 1735 | s32 offset[4]; |
1736 | u8 core; | 1736 | u8 core; |
1737 | u8 rail; | 1737 | u8 rail; |
1738 | 1738 | ||
@@ -1799,7 +1799,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) | |||
1799 | } | 1799 | } |
1800 | 1800 | ||
1801 | for (i = 0; i < 4; i++) { | 1801 | for (i = 0; i < 4; i++) { |
1802 | s32 mind = 40; | 1802 | s32 mind = 0x100000; |
1803 | u8 minvcm = 0; | 1803 | u8 minvcm = 0; |
1804 | s32 minpoll = 249; | 1804 | s32 minpoll = 249; |
1805 | s32 curr; | 1805 | s32 curr; |
@@ -5165,7 +5165,8 @@ static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid) | |||
5165 | #endif | 5165 | #endif |
5166 | #ifdef CONFIG_B43_SSB | 5166 | #ifdef CONFIG_B43_SSB |
5167 | case B43_BUS_SSB: | 5167 | case B43_BUS_SSB: |
5168 | /* FIXME */ | 5168 | ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco, |
5169 | avoid); | ||
5169 | break; | 5170 | break; |
5170 | #endif | 5171 | #endif |
5171 | } | 5172 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 4469321c0eb3..35fc68be158d 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -3317,15 +3317,15 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) | |||
3317 | goto err; | 3317 | goto err; |
3318 | } | 3318 | } |
3319 | 3319 | ||
3320 | /* External image takes precedence if specified */ | ||
3321 | if (brcmf_sdbrcm_download_code_file(bus)) { | 3320 | if (brcmf_sdbrcm_download_code_file(bus)) { |
3322 | brcmf_err("dongle image file download failed\n"); | 3321 | brcmf_err("dongle image file download failed\n"); |
3323 | goto err; | 3322 | goto err; |
3324 | } | 3323 | } |
3325 | 3324 | ||
3326 | /* External nvram takes precedence if specified */ | 3325 | if (brcmf_sdbrcm_download_nvram(bus)) { |
3327 | if (brcmf_sdbrcm_download_nvram(bus)) | ||
3328 | brcmf_err("dongle nvram file download failed\n"); | 3326 | brcmf_err("dongle nvram file download failed\n"); |
3327 | goto err; | ||
3328 | } | ||
3329 | 3329 | ||
3330 | /* Take arm out of reset */ | 3330 | /* Take arm out of reset */ |
3331 | if (brcmf_sdbrcm_download_state(bus, false)) { | 3331 | if (brcmf_sdbrcm_download_state(bus, false)) { |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 2af9c0f0798d..78da3eff75e8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -1891,8 +1891,10 @@ static s32 | |||
1891 | brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, | 1891 | brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, |
1892 | u8 key_idx, const u8 *mac_addr, struct key_params *params) | 1892 | u8 key_idx, const u8 *mac_addr, struct key_params *params) |
1893 | { | 1893 | { |
1894 | struct brcmf_if *ifp = netdev_priv(ndev); | ||
1894 | struct brcmf_wsec_key key; | 1895 | struct brcmf_wsec_key key; |
1895 | s32 err = 0; | 1896 | s32 err = 0; |
1897 | u8 keybuf[8]; | ||
1896 | 1898 | ||
1897 | memset(&key, 0, sizeof(key)); | 1899 | memset(&key, 0, sizeof(key)); |
1898 | key.index = (u32) key_idx; | 1900 | key.index = (u32) key_idx; |
@@ -1916,8 +1918,9 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, | |||
1916 | brcmf_dbg(CONN, "Setting the key index %d\n", key.index); | 1918 | brcmf_dbg(CONN, "Setting the key index %d\n", key.index); |
1917 | memcpy(key.data, params->key, key.len); | 1919 | memcpy(key.data, params->key, key.len); |
1918 | 1920 | ||
1919 | if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { | 1921 | if ((ifp->vif->mode != WL_MODE_AP) && |
1920 | u8 keybuf[8]; | 1922 | (params->cipher == WLAN_CIPHER_SUITE_TKIP)) { |
1923 | brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); | ||
1921 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); | 1924 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); |
1922 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); | 1925 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); |
1923 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); | 1926 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); |
@@ -2013,7 +2016,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, | |||
2013 | break; | 2016 | break; |
2014 | case WLAN_CIPHER_SUITE_TKIP: | 2017 | case WLAN_CIPHER_SUITE_TKIP: |
2015 | if (ifp->vif->mode != WL_MODE_AP) { | 2018 | if (ifp->vif->mode != WL_MODE_AP) { |
2016 | brcmf_dbg(CONN, "Swapping key\n"); | 2019 | brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); |
2017 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); | 2020 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); |
2018 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); | 2021 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); |
2019 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); | 2022 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); |
@@ -2118,8 +2121,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, | |||
2118 | err = -EAGAIN; | 2121 | err = -EAGAIN; |
2119 | goto done; | 2122 | goto done; |
2120 | } | 2123 | } |
2121 | switch (wsec & ~SES_OW_ENABLED) { | 2124 | if (wsec & WEP_ENABLED) { |
2122 | case WEP_ENABLED: | ||
2123 | sec = &profile->sec; | 2125 | sec = &profile->sec; |
2124 | if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { | 2126 | if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { |
2125 | params.cipher = WLAN_CIPHER_SUITE_WEP40; | 2127 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
@@ -2128,16 +2130,13 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, | |||
2128 | params.cipher = WLAN_CIPHER_SUITE_WEP104; | 2130 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
2129 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); | 2131 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); |
2130 | } | 2132 | } |
2131 | break; | 2133 | } else if (wsec & TKIP_ENABLED) { |
2132 | case TKIP_ENABLED: | ||
2133 | params.cipher = WLAN_CIPHER_SUITE_TKIP; | 2134 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
2134 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); | 2135 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); |
2135 | break; | 2136 | } else if (wsec & AES_ENABLED) { |
2136 | case AES_ENABLED: | ||
2137 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; | 2137 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
2138 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); | 2138 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); |
2139 | break; | 2139 | } else { |
2140 | default: | ||
2141 | brcmf_err("Invalid algo (0x%x)\n", wsec); | 2140 | brcmf_err("Invalid algo (0x%x)\n", wsec); |
2142 | err = -EINVAL; | 2141 | err = -EINVAL; |
2143 | goto done; | 2142 | goto done; |
@@ -3824,8 +3823,9 @@ exit: | |||
3824 | static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | 3823 | static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) |
3825 | { | 3824 | { |
3826 | struct brcmf_if *ifp = netdev_priv(ndev); | 3825 | struct brcmf_if *ifp = netdev_priv(ndev); |
3827 | s32 err = -EPERM; | 3826 | s32 err; |
3828 | struct brcmf_fil_bss_enable_le bss_enable; | 3827 | struct brcmf_fil_bss_enable_le bss_enable; |
3828 | struct brcmf_join_params join_params; | ||
3829 | 3829 | ||
3830 | brcmf_dbg(TRACE, "Enter\n"); | 3830 | brcmf_dbg(TRACE, "Enter\n"); |
3831 | 3831 | ||
@@ -3833,16 +3833,21 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | |||
3833 | /* Due to most likely deauths outstanding we sleep */ | 3833 | /* Due to most likely deauths outstanding we sleep */ |
3834 | /* first to make sure they get processed by fw. */ | 3834 | /* first to make sure they get processed by fw. */ |
3835 | msleep(400); | 3835 | msleep(400); |
3836 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); | 3836 | |
3837 | if (err < 0) { | 3837 | memset(&join_params, 0, sizeof(join_params)); |
3838 | brcmf_err("setting AP mode failed %d\n", err); | 3838 | err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, |
3839 | goto exit; | 3839 | &join_params, sizeof(join_params)); |
3840 | } | 3840 | if (err < 0) |
3841 | brcmf_err("SET SSID error (%d)\n", err); | ||
3841 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); | 3842 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); |
3842 | if (err < 0) { | 3843 | if (err < 0) |
3843 | brcmf_err("BRCMF_C_UP error %d\n", err); | 3844 | brcmf_err("BRCMF_C_UP error %d\n", err); |
3844 | goto exit; | 3845 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); |
3845 | } | 3846 | if (err < 0) |
3847 | brcmf_err("setting AP mode failed %d\n", err); | ||
3848 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 0); | ||
3849 | if (err < 0) | ||
3850 | brcmf_err("setting INFRA mode failed %d\n", err); | ||
3846 | } else { | 3851 | } else { |
3847 | bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); | 3852 | bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); |
3848 | bss_enable.enable = cpu_to_le32(0); | 3853 | bss_enable.enable = cpu_to_le32(0); |
@@ -3855,7 +3860,6 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | |||
3855 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); | 3860 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); |
3856 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); | 3861 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); |
3857 | 3862 | ||
3858 | exit: | ||
3859 | return err; | 3863 | return err; |
3860 | } | 3864 | } |
3861 | 3865 | ||
@@ -4124,10 +4128,6 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = { | |||
4124 | }, | 4128 | }, |
4125 | { | 4129 | { |
4126 | .max = 1, | 4130 | .max = 1, |
4127 | .types = BIT(NL80211_IFTYPE_P2P_DEVICE) | ||
4128 | }, | ||
4129 | { | ||
4130 | .max = 1, | ||
4131 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4131 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4132 | BIT(NL80211_IFTYPE_P2P_GO) | 4132 | BIT(NL80211_IFTYPE_P2P_GO) |
4133 | }, | 4133 | }, |
@@ -4183,8 +4183,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4183 | BIT(NL80211_IFTYPE_ADHOC) | | 4183 | BIT(NL80211_IFTYPE_ADHOC) | |
4184 | BIT(NL80211_IFTYPE_AP) | | 4184 | BIT(NL80211_IFTYPE_AP) | |
4185 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4185 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4186 | BIT(NL80211_IFTYPE_P2P_GO) | | 4186 | BIT(NL80211_IFTYPE_P2P_GO); |
4187 | BIT(NL80211_IFTYPE_P2P_DEVICE); | ||
4188 | wiphy->iface_combinations = brcmf_iface_combos; | 4187 | wiphy->iface_combinations = brcmf_iface_combos; |
4189 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); | 4188 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); |
4190 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; | 4189 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index c6451c61407a..e2340b231aa1 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -274,6 +274,130 @@ static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br) | |||
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | /** | ||
278 | * This function frees the WL per-device resources. | ||
279 | * | ||
280 | * This function frees resources owned by the WL device pointed to | ||
281 | * by the wl parameter. | ||
282 | * | ||
283 | * precondition: can both be called locked and unlocked | ||
284 | * | ||
285 | */ | ||
286 | static void brcms_free(struct brcms_info *wl) | ||
287 | { | ||
288 | struct brcms_timer *t, *next; | ||
289 | |||
290 | /* free ucode data */ | ||
291 | if (wl->fw.fw_cnt) | ||
292 | brcms_ucode_data_free(&wl->ucode); | ||
293 | if (wl->irq) | ||
294 | free_irq(wl->irq, wl); | ||
295 | |||
296 | /* kill dpc */ | ||
297 | tasklet_kill(&wl->tasklet); | ||
298 | |||
299 | if (wl->pub) { | ||
300 | brcms_debugfs_detach(wl->pub); | ||
301 | brcms_c_module_unregister(wl->pub, "linux", wl); | ||
302 | } | ||
303 | |||
304 | /* free common resources */ | ||
305 | if (wl->wlc) { | ||
306 | brcms_c_detach(wl->wlc); | ||
307 | wl->wlc = NULL; | ||
308 | wl->pub = NULL; | ||
309 | } | ||
310 | |||
311 | /* virtual interface deletion is deferred so we cannot spinwait */ | ||
312 | |||
313 | /* wait for all pending callbacks to complete */ | ||
314 | while (atomic_read(&wl->callbacks) > 0) | ||
315 | schedule(); | ||
316 | |||
317 | /* free timers */ | ||
318 | for (t = wl->timers; t; t = next) { | ||
319 | next = t->next; | ||
320 | #ifdef DEBUG | ||
321 | kfree(t->name); | ||
322 | #endif | ||
323 | kfree(t); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | * called from both kernel as from this kernel module (error flow on attach) | ||
329 | * precondition: perimeter lock is not acquired. | ||
330 | */ | ||
331 | static void brcms_remove(struct bcma_device *pdev) | ||
332 | { | ||
333 | struct ieee80211_hw *hw = bcma_get_drvdata(pdev); | ||
334 | struct brcms_info *wl = hw->priv; | ||
335 | |||
336 | if (wl->wlc) { | ||
337 | wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); | ||
338 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | ||
339 | ieee80211_unregister_hw(hw); | ||
340 | } | ||
341 | |||
342 | brcms_free(wl); | ||
343 | |||
344 | bcma_set_drvdata(pdev, NULL); | ||
345 | ieee80211_free_hw(hw); | ||
346 | } | ||
347 | |||
348 | /* | ||
349 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
350 | * no locking is required. | ||
351 | */ | ||
352 | static void brcms_release_fw(struct brcms_info *wl) | ||
353 | { | ||
354 | int i; | ||
355 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
356 | release_firmware(wl->fw.fw_bin[i]); | ||
357 | release_firmware(wl->fw.fw_hdr[i]); | ||
358 | } | ||
359 | } | ||
360 | |||
361 | /* | ||
362 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
363 | * no locking is required. | ||
364 | */ | ||
365 | static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) | ||
366 | { | ||
367 | int status; | ||
368 | struct device *device = &pdev->dev; | ||
369 | char fw_name[100]; | ||
370 | int i; | ||
371 | |||
372 | memset(&wl->fw, 0, sizeof(struct brcms_firmware)); | ||
373 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
374 | if (brcms_firmwares[i] == NULL) | ||
375 | break; | ||
376 | sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], | ||
377 | UCODE_LOADER_API_VER); | ||
378 | status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | ||
379 | if (status) { | ||
380 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
381 | KBUILD_MODNAME, fw_name); | ||
382 | return status; | ||
383 | } | ||
384 | sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], | ||
385 | UCODE_LOADER_API_VER); | ||
386 | status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | ||
387 | if (status) { | ||
388 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
389 | KBUILD_MODNAME, fw_name); | ||
390 | return status; | ||
391 | } | ||
392 | wl->fw.hdr_num_entries[i] = | ||
393 | wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); | ||
394 | } | ||
395 | wl->fw.fw_cnt = i; | ||
396 | status = brcms_ucode_data_init(wl, &wl->ucode); | ||
397 | brcms_release_fw(wl); | ||
398 | return status; | ||
399 | } | ||
400 | |||
277 | static void brcms_ops_tx(struct ieee80211_hw *hw, | 401 | static void brcms_ops_tx(struct ieee80211_hw *hw, |
278 | struct ieee80211_tx_control *control, | 402 | struct ieee80211_tx_control *control, |
279 | struct sk_buff *skb) | 403 | struct sk_buff *skb) |
@@ -306,6 +430,14 @@ static int brcms_ops_start(struct ieee80211_hw *hw) | |||
306 | if (!blocked) | 430 | if (!blocked) |
307 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | 431 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); |
308 | 432 | ||
433 | if (!wl->ucode.bcm43xx_bomminor) { | ||
434 | err = brcms_request_fw(wl, wl->wlc->hw->d11core); | ||
435 | if (err) { | ||
436 | brcms_remove(wl->wlc->hw->d11core); | ||
437 | return -ENOENT; | ||
438 | } | ||
439 | } | ||
440 | |||
309 | spin_lock_bh(&wl->lock); | 441 | spin_lock_bh(&wl->lock); |
310 | /* avoid acknowledging frames before a non-monitor device is added */ | 442 | /* avoid acknowledging frames before a non-monitor device is added */ |
311 | wl->mute_tx = true; | 443 | wl->mute_tx = true; |
@@ -793,128 +925,6 @@ void brcms_dpc(unsigned long data) | |||
793 | wake_up(&wl->tx_flush_wq); | 925 | wake_up(&wl->tx_flush_wq); |
794 | } | 926 | } |
795 | 927 | ||
796 | /* | ||
797 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
798 | * no locking is required. | ||
799 | */ | ||
800 | static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) | ||
801 | { | ||
802 | int status; | ||
803 | struct device *device = &pdev->dev; | ||
804 | char fw_name[100]; | ||
805 | int i; | ||
806 | |||
807 | memset(&wl->fw, 0, sizeof(struct brcms_firmware)); | ||
808 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
809 | if (brcms_firmwares[i] == NULL) | ||
810 | break; | ||
811 | sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], | ||
812 | UCODE_LOADER_API_VER); | ||
813 | status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | ||
814 | if (status) { | ||
815 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
816 | KBUILD_MODNAME, fw_name); | ||
817 | return status; | ||
818 | } | ||
819 | sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], | ||
820 | UCODE_LOADER_API_VER); | ||
821 | status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | ||
822 | if (status) { | ||
823 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
824 | KBUILD_MODNAME, fw_name); | ||
825 | return status; | ||
826 | } | ||
827 | wl->fw.hdr_num_entries[i] = | ||
828 | wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); | ||
829 | } | ||
830 | wl->fw.fw_cnt = i; | ||
831 | return brcms_ucode_data_init(wl, &wl->ucode); | ||
832 | } | ||
833 | |||
834 | /* | ||
835 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
836 | * no locking is required. | ||
837 | */ | ||
838 | static void brcms_release_fw(struct brcms_info *wl) | ||
839 | { | ||
840 | int i; | ||
841 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
842 | release_firmware(wl->fw.fw_bin[i]); | ||
843 | release_firmware(wl->fw.fw_hdr[i]); | ||
844 | } | ||
845 | } | ||
846 | |||
847 | /** | ||
848 | * This function frees the WL per-device resources. | ||
849 | * | ||
850 | * This function frees resources owned by the WL device pointed to | ||
851 | * by the wl parameter. | ||
852 | * | ||
853 | * precondition: can both be called locked and unlocked | ||
854 | * | ||
855 | */ | ||
856 | static void brcms_free(struct brcms_info *wl) | ||
857 | { | ||
858 | struct brcms_timer *t, *next; | ||
859 | |||
860 | /* free ucode data */ | ||
861 | if (wl->fw.fw_cnt) | ||
862 | brcms_ucode_data_free(&wl->ucode); | ||
863 | if (wl->irq) | ||
864 | free_irq(wl->irq, wl); | ||
865 | |||
866 | /* kill dpc */ | ||
867 | tasklet_kill(&wl->tasklet); | ||
868 | |||
869 | if (wl->pub) { | ||
870 | brcms_debugfs_detach(wl->pub); | ||
871 | brcms_c_module_unregister(wl->pub, "linux", wl); | ||
872 | } | ||
873 | |||
874 | /* free common resources */ | ||
875 | if (wl->wlc) { | ||
876 | brcms_c_detach(wl->wlc); | ||
877 | wl->wlc = NULL; | ||
878 | wl->pub = NULL; | ||
879 | } | ||
880 | |||
881 | /* virtual interface deletion is deferred so we cannot spinwait */ | ||
882 | |||
883 | /* wait for all pending callbacks to complete */ | ||
884 | while (atomic_read(&wl->callbacks) > 0) | ||
885 | schedule(); | ||
886 | |||
887 | /* free timers */ | ||
888 | for (t = wl->timers; t; t = next) { | ||
889 | next = t->next; | ||
890 | #ifdef DEBUG | ||
891 | kfree(t->name); | ||
892 | #endif | ||
893 | kfree(t); | ||
894 | } | ||
895 | } | ||
896 | |||
897 | /* | ||
898 | * called from both kernel as from this kernel module (error flow on attach) | ||
899 | * precondition: perimeter lock is not acquired. | ||
900 | */ | ||
901 | static void brcms_remove(struct bcma_device *pdev) | ||
902 | { | ||
903 | struct ieee80211_hw *hw = bcma_get_drvdata(pdev); | ||
904 | struct brcms_info *wl = hw->priv; | ||
905 | |||
906 | if (wl->wlc) { | ||
907 | wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); | ||
908 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | ||
909 | ieee80211_unregister_hw(hw); | ||
910 | } | ||
911 | |||
912 | brcms_free(wl); | ||
913 | |||
914 | bcma_set_drvdata(pdev, NULL); | ||
915 | ieee80211_free_hw(hw); | ||
916 | } | ||
917 | |||
918 | static irqreturn_t brcms_isr(int irq, void *dev_id) | 928 | static irqreturn_t brcms_isr(int irq, void *dev_id) |
919 | { | 929 | { |
920 | struct brcms_info *wl; | 930 | struct brcms_info *wl; |
@@ -1047,18 +1057,8 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev) | |||
1047 | spin_lock_init(&wl->lock); | 1057 | spin_lock_init(&wl->lock); |
1048 | spin_lock_init(&wl->isr_lock); | 1058 | spin_lock_init(&wl->isr_lock); |
1049 | 1059 | ||
1050 | /* prepare ucode */ | ||
1051 | if (brcms_request_fw(wl, pdev) < 0) { | ||
1052 | wiphy_err(wl->wiphy, "%s: Failed to find firmware usually in " | ||
1053 | "%s\n", KBUILD_MODNAME, "/lib/firmware/brcm"); | ||
1054 | brcms_release_fw(wl); | ||
1055 | brcms_remove(pdev); | ||
1056 | return NULL; | ||
1057 | } | ||
1058 | |||
1059 | /* common load-time initialization */ | 1060 | /* common load-time initialization */ |
1060 | wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); | 1061 | wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); |
1061 | brcms_release_fw(wl); | ||
1062 | if (!wl->wlc) { | 1062 | if (!wl->wlc) { |
1063 | wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", | 1063 | wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", |
1064 | KBUILD_MODNAME, err); | 1064 | KBUILD_MODNAME, err); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c index 21a824232478..18d37645e2cd 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | |||
@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1137 | gain0_15 = ((biq1 & 0xf) << 12) | | 1137 | gain0_15 = ((biq1 & 0xf) << 12) | |
1138 | ((tia & 0xf) << 8) | | 1138 | ((tia & 0xf) << 8) | |
1139 | ((lna2 & 0x3) << 6) | | 1139 | ((lna2 & 0x3) << 6) | |
1140 | ((lna2 & 0x3) << 4) | | 1140 | ((lna2 & |
1141 | ((lna1 & 0x3) << 2) | | 1141 | 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); |
1142 | ((lna1 & 0x3) << 0); | ||
1143 | 1142 | ||
1144 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); | 1143 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); |
1145 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); | 1144 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); |
@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1157 | } | 1156 | } |
1158 | 1157 | ||
1159 | mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); | 1158 | mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); |
1160 | mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); | ||
1161 | mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3); | ||
1162 | 1159 | ||
1163 | } | 1160 | } |
1164 | 1161 | ||
@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples) | |||
1331 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; | 1328 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; |
1332 | } | 1329 | } |
1333 | 1330 | ||
1334 | static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, | ||
1335 | u16 tia_gain, u16 lna2_gain) | ||
1336 | { | ||
1337 | u32 i_thresh_l, q_thresh_l; | ||
1338 | u32 i_thresh_h, q_thresh_h; | ||
1339 | struct lcnphy_iq_est iq_est_h, iq_est_l; | ||
1340 | |||
1341 | wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain, | ||
1342 | lna2_gain, 0); | ||
1343 | |||
1344 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1345 | wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); | ||
1346 | udelay(500); | ||
1347 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1348 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) | ||
1349 | return false; | ||
1350 | |||
1351 | wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); | ||
1352 | udelay(500); | ||
1353 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1354 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) | ||
1355 | return false; | ||
1356 | |||
1357 | i_thresh_l = (iq_est_l.i_pwr << 1); | ||
1358 | i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr; | ||
1359 | |||
1360 | q_thresh_l = (iq_est_l.q_pwr << 1); | ||
1361 | q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr; | ||
1362 | if ((iq_est_h.i_pwr > i_thresh_l) && | ||
1363 | (iq_est_h.i_pwr < i_thresh_h) && | ||
1364 | (iq_est_h.q_pwr > q_thresh_l) && | ||
1365 | (iq_est_h.q_pwr < q_thresh_h)) | ||
1366 | return true; | ||
1367 | |||
1368 | return false; | ||
1369 | } | ||
1370 | |||
1371 | static bool | 1331 | static bool |
1372 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | 1332 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, |
1373 | const struct lcnphy_rx_iqcomp *iqcomp, | 1333 | const struct lcnphy_rx_iqcomp *iqcomp, |
@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1382 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, | 1342 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, |
1383 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, | 1343 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, |
1384 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; | 1344 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; |
1385 | int tia_gain, lna2_gain, biq1_gain; | 1345 | int tia_gain; |
1386 | bool set_gain; | 1346 | u32 received_power, rx_pwr_threshold; |
1387 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; | 1347 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; |
1388 | u16 values_to_save[11]; | 1348 | u16 values_to_save[11]; |
1389 | s16 *ptr; | 1349 | s16 *ptr; |
@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1408 | goto cal_done; | 1368 | goto cal_done; |
1409 | } | 1369 | } |
1410 | 1370 | ||
1411 | WARN_ON(module != 1); | 1371 | if (module == 1) { |
1412 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); | ||
1413 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); | ||
1414 | |||
1415 | for (i = 0; i < 11; i++) | ||
1416 | values_to_save[i] = | ||
1417 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1418 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1419 | |||
1420 | or_phy_reg(pi, 0x631, 0x0015); | ||
1421 | |||
1422 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1423 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1424 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1425 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1426 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1427 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1428 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1429 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1430 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1431 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1432 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1433 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1434 | |||
1435 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1436 | if (tx_gain_override_old) { | ||
1437 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1438 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1439 | } | ||
1440 | |||
1441 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); | ||
1442 | 1372 | ||
1443 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); | 1373 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); |
1444 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); | 1374 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); |
1445 | 1375 | ||
1446 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); | 1376 | for (i = 0; i < 11; i++) |
1447 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); | 1377 | values_to_save[i] = |
1378 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1379 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1380 | |||
1381 | or_phy_reg(pi, 0x631, 0x0015); | ||
1382 | |||
1383 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1384 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1385 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1386 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1387 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1388 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1389 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1390 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1391 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1392 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1393 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1394 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1395 | |||
1396 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1397 | if (tx_gain_override_old) { | ||
1398 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1399 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1400 | } | ||
1448 | 1401 | ||
1449 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); | 1402 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); |
1450 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); | ||
1451 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | ||
1452 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); | ||
1453 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); | ||
1454 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); | ||
1455 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | ||
1456 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); | ||
1457 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); | ||
1458 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | ||
1459 | |||
1460 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); | ||
1461 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); | ||
1462 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); | ||
1463 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); | ||
1464 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); | ||
1465 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); | ||
1466 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); | ||
1467 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); | ||
1468 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); | ||
1469 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | ||
1470 | 1403 | ||
1471 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | 1404 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); |
1472 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | 1405 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); |
1473 | 1406 | ||
1474 | write_phy_reg(pi, 0x6da, 0xffff); | 1407 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); |
1475 | or_phy_reg(pi, 0x6db, 0x3); | 1408 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); |
1476 | 1409 | ||
1477 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | 1410 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); |
1478 | set_gain = false; | 1411 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); |
1479 | 1412 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | |
1480 | lna2_gain = 3; | 1413 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); |
1481 | while ((lna2_gain >= 0) && !set_gain) { | 1414 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); |
1482 | tia_gain = 4; | 1415 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); |
1483 | 1416 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | |
1484 | while ((tia_gain >= 0) && !set_gain) { | 1417 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); |
1485 | biq1_gain = 6; | 1418 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); |
1486 | 1419 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | |
1487 | while ((biq1_gain >= 0) && !set_gain) { | 1420 | |
1488 | set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, | 1421 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); |
1489 | (u16) | 1422 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); |
1490 | biq1_gain, | 1423 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); |
1491 | (u16) | 1424 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); |
1492 | tia_gain, | 1425 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); |
1493 | (u16) | 1426 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); |
1494 | lna2_gain); | 1427 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); |
1495 | biq1_gain -= 1; | 1428 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); |
1496 | } | 1429 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); |
1430 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | ||
1431 | |||
1432 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | ||
1433 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | ||
1434 | |||
1435 | wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); | ||
1436 | write_phy_reg(pi, 0x6da, 0xffff); | ||
1437 | or_phy_reg(pi, 0x6db, 0x3); | ||
1438 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | ||
1439 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1440 | |||
1441 | tia_gain = 8; | ||
1442 | rx_pwr_threshold = 950; | ||
1443 | while (tia_gain > 0) { | ||
1497 | tia_gain -= 1; | 1444 | tia_gain -= 1; |
1445 | wlc_lcnphy_set_rx_gain_by_distribution(pi, | ||
1446 | 0, 0, 2, 2, | ||
1447 | (u16) | ||
1448 | tia_gain, 1, 0); | ||
1449 | udelay(500); | ||
1450 | |||
1451 | received_power = | ||
1452 | wlc_lcnphy_measure_digital_power(pi, 2000); | ||
1453 | if (received_power < rx_pwr_threshold) | ||
1454 | break; | ||
1498 | } | 1455 | } |
1499 | lna2_gain -= 1; | 1456 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); |
1500 | } | ||
1501 | 1457 | ||
1502 | if (set_gain) | 1458 | wlc_lcnphy_stop_tx_tone(pi); |
1503 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024); | ||
1504 | else | ||
1505 | result = false; | ||
1506 | 1459 | ||
1507 | wlc_lcnphy_stop_tx_tone(pi); | 1460 | write_phy_reg(pi, 0x631, Core1TxControl_old); |
1508 | 1461 | ||
1509 | write_phy_reg(pi, 0x631, Core1TxControl_old); | 1462 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); |
1510 | 1463 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | |
1511 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); | 1464 | write_phy_reg(pi, 0x4b0, rfoverride2_old); |
1512 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | 1465 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); |
1513 | write_phy_reg(pi, 0x4b0, rfoverride2_old); | 1466 | write_phy_reg(pi, 0x4f9, rfoverride3_old); |
1514 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); | 1467 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); |
1515 | write_phy_reg(pi, 0x4f9, rfoverride3_old); | 1468 | write_phy_reg(pi, 0x938, rfoverride4_old); |
1516 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); | 1469 | write_phy_reg(pi, 0x939, rfoverride4val_old); |
1517 | write_phy_reg(pi, 0x938, rfoverride4_old); | 1470 | write_phy_reg(pi, 0x43b, afectrlovr_old); |
1518 | write_phy_reg(pi, 0x939, rfoverride4val_old); | 1471 | write_phy_reg(pi, 0x43c, afectrlovrval_old); |
1519 | write_phy_reg(pi, 0x43b, afectrlovr_old); | 1472 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); |
1520 | write_phy_reg(pi, 0x43c, afectrlovrval_old); | 1473 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); |
1521 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); | ||
1522 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); | ||
1523 | 1474 | ||
1524 | wlc_lcnphy_clear_trsw_override(pi); | 1475 | wlc_lcnphy_clear_trsw_override(pi); |
1525 | 1476 | ||
1526 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); | 1477 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); |
1527 | 1478 | ||
1528 | for (i = 0; i < 11; i++) | 1479 | for (i = 0; i < 11; i++) |
1529 | write_radio_reg(pi, rxiq_cal_rf_reg[i], | 1480 | write_radio_reg(pi, rxiq_cal_rf_reg[i], |
1530 | values_to_save[i]); | 1481 | values_to_save[i]); |
1531 | 1482 | ||
1532 | if (tx_gain_override_old) | 1483 | if (tx_gain_override_old) |
1533 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); | 1484 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); |
1534 | else | 1485 | else |
1535 | wlc_lcnphy_disable_tx_gain_override(pi); | 1486 | wlc_lcnphy_disable_tx_gain_override(pi); |
1536 | 1487 | ||
1537 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); | 1488 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); |
1538 | wlc_lcnphy_rx_gain_override_enable(pi, false); | 1489 | wlc_lcnphy_rx_gain_override_enable(pi, false); |
1490 | } | ||
1539 | 1491 | ||
1540 | cal_done: | 1492 | cal_done: |
1541 | kfree(ptr); | 1493 | kfree(ptr); |
@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel) | |||
1829 | write_radio_reg(pi, RADIO_2064_REG038, 3); | 1781 | write_radio_reg(pi, RADIO_2064_REG038, 3); |
1830 | write_radio_reg(pi, RADIO_2064_REG091, 7); | 1782 | write_radio_reg(pi, RADIO_2064_REG091, 7); |
1831 | } | 1783 | } |
1832 | |||
1833 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
1834 | u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc, | ||
1835 | 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0}; | ||
1836 | |||
1837 | write_radio_reg(pi, RADIO_2064_REG02A, 0xf); | ||
1838 | write_radio_reg(pi, RADIO_2064_REG091, 0x3); | ||
1839 | write_radio_reg(pi, RADIO_2064_REG038, 0x3); | ||
1840 | |||
1841 | write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]); | ||
1842 | } | ||
1843 | } | 1784 | } |
1844 | 1785 | ||
1845 | static int | 1786 | static int |
@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos) | |||
2034 | } else { | 1975 | } else { |
2035 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); | 1976 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); |
2036 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | 1977 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); |
2037 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0); | ||
2038 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2); | ||
2039 | mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0); | ||
2040 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4); | ||
2041 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2042 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77); | ||
2043 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1); | ||
2044 | mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7); | ||
2045 | mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1); | ||
2046 | mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4); | ||
2047 | } | 1978 | } |
2048 | } else { | 1979 | } else { |
2049 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); | 1980 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); |
@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi) | |||
2130 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); | 2061 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); |
2131 | 2062 | ||
2132 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); | 2063 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); |
2133 | mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0)); | ||
2134 | } | 2064 | } |
2135 | 2065 | ||
2136 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | 2066 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) |
2137 | { | 2067 | { |
2138 | struct phytbl_info tab; | 2068 | struct phytbl_info tab; |
2139 | u32 rfseq, ind; | 2069 | u32 rfseq, ind; |
2140 | u8 tssi_sel; | ||
2141 | 2070 | ||
2142 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 2071 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
2143 | tab.tbl_width = 32; | 2072 | tab.tbl_width = 32; |
@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2159 | 2088 | ||
2160 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); | 2089 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); |
2161 | 2090 | ||
2162 | if (pi->sh->boardflags & BFL_FEM) { | 2091 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); |
2163 | tssi_sel = 0x1; | ||
2164 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); | ||
2165 | } else { | ||
2166 | tssi_sel = 0xe; | ||
2167 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA); | ||
2168 | } | ||
2169 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); | 2092 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); |
2170 | 2093 | ||
2171 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); | 2094 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); |
@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2201 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); | 2124 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); |
2202 | 2125 | ||
2203 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { | 2126 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { |
2204 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); | 2127 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); |
2205 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); | 2128 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); |
2206 | } else { | 2129 | } else { |
2207 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1); | ||
2208 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); | 2130 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); |
2209 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); | 2131 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); |
2210 | } | 2132 | } |
@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2251 | 2173 | ||
2252 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); | 2174 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); |
2253 | 2175 | ||
2254 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0); | ||
2255 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2256 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | ||
2257 | |||
2258 | wlc_lcnphy_pwrctrl_rssiparams(pi); | 2176 | wlc_lcnphy_pwrctrl_rssiparams(pi); |
2259 | } | 2177 | } |
2260 | 2178 | ||
@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2873 | read_radio_reg(pi, RADIO_2064_REG007) & 1; | 2791 | read_radio_reg(pi, RADIO_2064_REG007) & 1; |
2874 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; | 2792 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; |
2875 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; | 2793 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; |
2876 | u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi); | ||
2877 | |||
2878 | idleTssi = read_phy_reg(pi, 0x4ab); | 2794 | idleTssi = read_phy_reg(pi, 0x4ab); |
2879 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & | 2795 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & |
2880 | MCTL_EN_MAC)); | 2796 | MCTL_EN_MAC)); |
@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2892 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); | 2808 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); |
2893 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); | 2809 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); |
2894 | wlc_lcnphy_tssi_setup(pi); | 2810 | wlc_lcnphy_tssi_setup(pi); |
2895 | |||
2896 | mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0)); | ||
2897 | mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6)); | ||
2898 | |||
2899 | wlc_lcnphy_set_bbmult(pi, 0x0); | ||
2900 | |||
2901 | wlc_phy_do_dummy_tx(pi, true, OFF); | 2811 | wlc_phy_do_dummy_tx(pi, true, OFF); |
2902 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) | 2812 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) |
2903 | >> 0); | 2813 | >> 0); |
@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2919 | 2829 | ||
2920 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); | 2830 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); |
2921 | 2831 | ||
2922 | wlc_lcnphy_set_bbmult(pi, SAVE_bbmult); | ||
2923 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); | 2832 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); |
2924 | wlc_lcnphy_set_tx_gain(pi, &old_gains); | 2833 | wlc_lcnphy_set_tx_gain(pi, &old_gains); |
2925 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); | 2834 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); |
@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi) | |||
3133 | wlc_lcnphy_write_table(pi, &tab); | 3042 | wlc_lcnphy_write_table(pi, &tab); |
3134 | tab.tbl_offset++; | 3043 | tab.tbl_offset++; |
3135 | } | 3044 | } |
3136 | mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0); | ||
3137 | mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0); | ||
3138 | mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8); | ||
3139 | mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4); | ||
3140 | mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2); | ||
3141 | 3045 | ||
3142 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); | 3046 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); |
3143 | 3047 | ||
@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3939 | target_gains.pad_gain = 21; | 3843 | target_gains.pad_gain = 21; |
3940 | target_gains.dac_gain = 0; | 3844 | target_gains.dac_gain = 0; |
3941 | wlc_lcnphy_set_tx_gain(pi, &target_gains); | 3845 | wlc_lcnphy_set_tx_gain(pi, &target_gains); |
3846 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3942 | 3847 | ||
3943 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { | 3848 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { |
3944 | 3849 | ||
@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3949 | lcnphy_recal ? LCNPHY_CAL_RECAL : | 3854 | lcnphy_recal ? LCNPHY_CAL_RECAL : |
3950 | LCNPHY_CAL_FULL), false); | 3855 | LCNPHY_CAL_FULL), false); |
3951 | } else { | 3856 | } else { |
3952 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3953 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); | 3857 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); |
3954 | } | 3858 | } |
3955 | 3859 | ||
@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi, | |||
4374 | if (CHSPEC_IS5G(pi->radio_chanspec)) | 4278 | if (CHSPEC_IS5G(pi->radio_chanspec)) |
4375 | pa_gain = 0x70; | 4279 | pa_gain = 0x70; |
4376 | else | 4280 | else |
4377 | pa_gain = 0x60; | 4281 | pa_gain = 0x70; |
4378 | 4282 | ||
4379 | if (pi->sh->boardflags & BFL_FEM) | 4283 | if (pi->sh->boardflags & BFL_FEM) |
4380 | pa_gain = 0x10; | 4284 | pa_gain = 0x10; |
4381 | |||
4382 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 4285 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
4383 | tab.tbl_width = 32; | 4286 | tab.tbl_width = 32; |
4384 | tab.tbl_len = 1; | 4287 | tab.tbl_len = 1; |
4385 | tab.tbl_ptr = &val; | 4288 | tab.tbl_ptr = &val; |
4386 | 4289 | ||
4387 | for (j = 0; j < 128; j++) { | 4290 | for (j = 0; j < 128; j++) { |
4388 | if (pi->sh->boardflags & BFL_FEM) | 4291 | gm_gain = gain_table[j].gm; |
4389 | gm_gain = gain_table[j].gm; | ||
4390 | else | ||
4391 | gm_gain = 15; | ||
4392 | |||
4393 | val = (((u32) pa_gain << 24) | | 4292 | val = (((u32) pa_gain << 24) | |
4394 | (gain_table[j].pad << 16) | | 4293 | (gain_table[j].pad << 16) | |
4395 | (gain_table[j].pga << 8) | gm_gain); | 4294 | (gain_table[j].pga << 8) | gm_gain); |
@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4600 | 4499 | ||
4601 | write_phy_reg(pi, 0x4ea, 0x4688); | 4500 | write_phy_reg(pi, 0x4ea, 0x4688); |
4602 | 4501 | ||
4603 | if (pi->sh->boardflags & BFL_FEM) | 4502 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); |
4604 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); | ||
4605 | else | ||
4606 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0); | ||
4607 | 4503 | ||
4608 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); | 4504 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); |
4609 | 4505 | ||
@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4614 | wlc_lcnphy_rcal(pi); | 4510 | wlc_lcnphy_rcal(pi); |
4615 | 4511 | ||
4616 | wlc_lcnphy_rc_cal(pi); | 4512 | wlc_lcnphy_rc_cal(pi); |
4617 | |||
4618 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
4619 | write_radio_reg(pi, RADIO_2064_REG032, 0x6f); | ||
4620 | write_radio_reg(pi, RADIO_2064_REG033, 0x19); | ||
4621 | write_radio_reg(pi, RADIO_2064_REG039, 0xe); | ||
4622 | } | ||
4623 | |||
4624 | } | 4513 | } |
4625 | 4514 | ||
4626 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) | 4515 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) |
@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4650 | wlc_lcnphy_write_table(pi, &tab); | 4539 | wlc_lcnphy_write_table(pi, &tab); |
4651 | } | 4540 | } |
4652 | 4541 | ||
4653 | if (!(pi->sh->boardflags & BFL_FEM)) { | 4542 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; |
4654 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; | 4543 | tab.tbl_width = 16; |
4655 | tab.tbl_width = 16; | 4544 | tab.tbl_ptr = &val; |
4656 | tab.tbl_ptr = &val; | 4545 | tab.tbl_len = 1; |
4657 | tab.tbl_len = 1; | ||
4658 | 4546 | ||
4659 | val = 150; | 4547 | val = 114; |
4660 | tab.tbl_offset = 0; | 4548 | tab.tbl_offset = 0; |
4661 | wlc_lcnphy_write_table(pi, &tab); | 4549 | wlc_lcnphy_write_table(pi, &tab); |
4662 | 4550 | ||
4663 | val = 220; | 4551 | val = 130; |
4664 | tab.tbl_offset = 1; | 4552 | tab.tbl_offset = 1; |
4665 | wlc_lcnphy_write_table(pi, &tab); | 4553 | wlc_lcnphy_write_table(pi, &tab); |
4666 | } | 4554 | |
4555 | val = 6; | ||
4556 | tab.tbl_offset = 8; | ||
4557 | wlc_lcnphy_write_table(pi, &tab); | ||
4667 | 4558 | ||
4668 | if (CHSPEC_IS2G(pi->radio_chanspec)) { | 4559 | if (CHSPEC_IS2G(pi->radio_chanspec)) { |
4669 | if (pi->sh->boardflags & BFL_FEM) | 4560 | if (pi->sh->boardflags & BFL_FEM) |
@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) | |||
5055 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); | 4946 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); |
5056 | 4947 | ||
5057 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); | 4948 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); |
5058 | wlc_lcnphy_tssi_setup(pi); | ||
5059 | } | 4949 | } |
5060 | 4950 | ||
5061 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) | 4951 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) |
@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) | |||
5094 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) | 4984 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) |
5095 | return false; | 4985 | return false; |
5096 | 4986 | ||
5097 | if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { | 4987 | if ((pi->sh->boardflags & BFL_FEM) && |
4988 | (LCNREV_IS(pi->pubpi.phy_rev, 1))) { | ||
5098 | if (pi_lcn->lcnphy_tempsense_option == 3) { | 4989 | if (pi_lcn->lcnphy_tempsense_option == 3) { |
5099 | pi->hwpwrctrl = true; | 4990 | pi->hwpwrctrl = true; |
5100 | pi->hwpwrctrl_capable = true; | 4991 | pi->hwpwrctrl_capable = true; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c index b7e95acc2084..622c01ca72c5 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | |||
@@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = { | |||
1992 | }; | 1992 | }; |
1993 | 1993 | ||
1994 | static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { | 1994 | static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { |
1995 | 0x0009, | ||
1996 | 0x000a, | 1995 | 0x000a, |
1997 | 0x0005, | ||
1998 | 0x0006, | ||
1999 | 0x0009, | 1996 | 0x0009, |
2000 | 0x000a, | ||
2001 | 0x0005, | ||
2002 | 0x0006, | 1997 | 0x0006, |
2003 | 0x0009, | ||
2004 | 0x000a, | ||
2005 | 0x0005, | 1998 | 0x0005, |
2006 | 0x0006, | ||
2007 | 0x0009, | ||
2008 | 0x000a, | 1999 | 0x000a, |
2009 | 0x0005, | ||
2010 | 0x0006, | ||
2011 | 0x0009, | 2000 | 0x0009, |
2012 | 0x000a, | ||
2013 | 0x0005, | ||
2014 | 0x0006, | 2001 | 0x0006, |
2015 | 0x0009, | ||
2016 | 0x000a, | ||
2017 | 0x0005, | 2002 | 0x0005, |
2018 | 0x0006, | ||
2019 | 0x0009, | ||
2020 | 0x000a, | 2003 | 0x000a, |
2021 | 0x0005, | ||
2022 | 0x0006, | ||
2023 | 0x0009, | 2004 | 0x0009, |
2024 | 0x000a, | ||
2025 | 0x0005, | ||
2026 | 0x0006, | 2005 | 0x0006, |
2027 | 0x0009, | ||
2028 | 0x000a, | ||
2029 | 0x0005, | 2006 | 0x0005, |
2030 | 0x0006, | ||
2031 | 0x0009, | ||
2032 | 0x000a, | 2007 | 0x000a, |
2033 | 0x0005, | ||
2034 | 0x0006, | ||
2035 | 0x0009, | 2008 | 0x0009, |
2036 | 0x000a, | ||
2037 | 0x0005, | ||
2038 | 0x0006, | 2009 | 0x0006, |
2039 | 0x0009, | ||
2040 | 0x000a, | ||
2041 | 0x0005, | 2010 | 0x0005, |
2042 | 0x0006, | 2011 | 0x000a, |
2043 | 0x0009, | 2012 | 0x0009, |
2013 | 0x0006, | ||
2014 | 0x0005, | ||
2044 | 0x000a, | 2015 | 0x000a, |
2016 | 0x0009, | ||
2017 | 0x0006, | ||
2045 | 0x0005, | 2018 | 0x0005, |
2019 | 0x000a, | ||
2020 | 0x0009, | ||
2046 | 0x0006, | 2021 | 0x0006, |
2022 | 0x0005, | ||
2023 | 0x000a, | ||
2047 | 0x0009, | 2024 | 0x0009, |
2025 | 0x0006, | ||
2026 | 0x0005, | ||
2048 | 0x000a, | 2027 | 0x000a, |
2028 | 0x0009, | ||
2029 | 0x0006, | ||
2049 | 0x0005, | 2030 | 0x0005, |
2031 | 0x000a, | ||
2032 | 0x0009, | ||
2050 | 0x0006, | 2033 | 0x0006, |
2034 | 0x0005, | ||
2035 | 0x000a, | ||
2051 | 0x0009, | 2036 | 0x0009, |
2037 | 0x0006, | ||
2038 | 0x0005, | ||
2052 | 0x000a, | 2039 | 0x000a, |
2040 | 0x0009, | ||
2041 | 0x0006, | ||
2053 | 0x0005, | 2042 | 0x0005, |
2043 | 0x000a, | ||
2044 | 0x0009, | ||
2054 | 0x0006, | 2045 | 0x0006, |
2046 | 0x0005, | ||
2047 | 0x000a, | ||
2055 | 0x0009, | 2048 | 0x0009, |
2049 | 0x0006, | ||
2050 | 0x0005, | ||
2056 | 0x000a, | 2051 | 0x000a, |
2052 | 0x0009, | ||
2053 | 0x0006, | ||
2057 | 0x0005, | 2054 | 0x0005, |
2055 | 0x000a, | ||
2056 | 0x0009, | ||
2058 | 0x0006, | 2057 | 0x0006, |
2058 | 0x0005, | ||
2059 | }; | 2059 | }; |
2060 | 2060 | ||
2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { | 2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 3630a41df50d..c353b5f19c8c 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -475,6 +475,7 @@ il3945_tx_skb(struct il_priv *il, | |||
475 | dma_addr_t txcmd_phys; | 475 | dma_addr_t txcmd_phys; |
476 | int txq_id = skb_get_queue_mapping(skb); | 476 | int txq_id = skb_get_queue_mapping(skb); |
477 | u16 len, idx, hdr_len; | 477 | u16 len, idx, hdr_len; |
478 | u16 firstlen, secondlen; | ||
478 | u8 id; | 479 | u8 id; |
479 | u8 unicast; | 480 | u8 unicast; |
480 | u8 sta_id; | 481 | u8 sta_id; |
@@ -589,21 +590,22 @@ il3945_tx_skb(struct il_priv *il, | |||
589 | len = | 590 | len = |
590 | sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + | 591 | sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + |
591 | hdr_len; | 592 | hdr_len; |
592 | len = (len + 3) & ~3; | 593 | firstlen = (len + 3) & ~3; |
593 | 594 | ||
594 | /* Physical address of this Tx command's header (not MAC header!), | 595 | /* Physical address of this Tx command's header (not MAC header!), |
595 | * within command buffer array. */ | 596 | * within command buffer array. */ |
596 | txcmd_phys = | 597 | txcmd_phys = |
597 | pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE); | 598 | pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, |
599 | PCI_DMA_TODEVICE); | ||
598 | if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) | 600 | if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) |
599 | goto drop_unlock; | 601 | goto drop_unlock; |
600 | 602 | ||
601 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 603 | /* Set up TFD's 2nd entry to point directly to remainder of skb, |
602 | * if any (802.11 null frames have no payload). */ | 604 | * if any (802.11 null frames have no payload). */ |
603 | len = skb->len - hdr_len; | 605 | secondlen = skb->len - hdr_len; |
604 | if (len) { | 606 | if (secondlen > 0) { |
605 | phys_addr = | 607 | phys_addr = |
606 | pci_map_single(il->pci_dev, skb->data + hdr_len, len, | 608 | pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, |
607 | PCI_DMA_TODEVICE); | 609 | PCI_DMA_TODEVICE); |
608 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) | 610 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) |
609 | goto drop_unlock; | 611 | goto drop_unlock; |
@@ -611,12 +613,12 @@ il3945_tx_skb(struct il_priv *il, | |||
611 | 613 | ||
612 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 614 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
613 | * first entry */ | 615 | * first entry */ |
614 | il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0); | 616 | il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); |
615 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | 617 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); |
616 | dma_unmap_len_set(out_meta, len, len); | 618 | dma_unmap_len_set(out_meta, len, firstlen); |
617 | if (len) | 619 | if (secondlen > 0) |
618 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0, | 620 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0, |
619 | U32_PAD(len)); | 621 | U32_PAD(secondlen)); |
620 | 622 | ||
621 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 623 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
622 | txq->need_update = 1; | 624 | txq->need_update = 1; |
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c index e8324b5e5bfe..6c7493c2d698 100644 --- a/drivers/net/wireless/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/iwlegacy/4965-rs.c | |||
@@ -2152,7 +2152,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, | |||
2152 | int rate_idx; | 2152 | int rate_idx; |
2153 | int i; | 2153 | int i; |
2154 | u32 rate; | 2154 | u32 rate; |
2155 | u8 use_green = il4965_rs_use_green(il, sta); | 2155 | u8 use_green; |
2156 | u8 active_tbl = 0; | 2156 | u8 active_tbl = 0; |
2157 | u8 valid_tx_ant; | 2157 | u8 valid_tx_ant; |
2158 | struct il_station_priv *sta_priv; | 2158 | struct il_station_priv *sta_priv; |
@@ -2160,6 +2160,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, | |||
2160 | if (!sta || !lq_sta) | 2160 | if (!sta || !lq_sta) |
2161 | return; | 2161 | return; |
2162 | 2162 | ||
2163 | use_green = il4965_rs_use_green(il, sta); | ||
2163 | sta_priv = (void *)sta->drv_priv; | 2164 | sta_priv = (void *)sta->drv_priv; |
2164 | 2165 | ||
2165 | i = lq_sta->last_txrate_idx; | 2166 | i = lq_sta->last_txrate_idx; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c index 86ea5f4c3939..44ca0e57f9f7 100644 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/iwlwifi/dvm/lib.c | |||
@@ -1262,6 +1262,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | /* | 1264 | /* |
1265 | * This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag | ||
1266 | * in iwl_down but cancel the workers only later. | ||
1267 | */ | ||
1268 | if (!priv->ucode_loaded) { | ||
1269 | IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id); | ||
1270 | return -EIO; | ||
1271 | } | ||
1272 | |||
1273 | /* | ||
1265 | * Synchronous commands from this op-mode must hold | 1274 | * Synchronous commands from this op-mode must hold |
1266 | * the mutex, this ensures we don't try to send two | 1275 | * the mutex, this ensures we don't try to send two |
1267 | * (or more) synchronous commands at a time. | 1276 | * (or more) synchronous commands at a time. |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index 23be948cf162..a82b6b39d4ff 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
@@ -1419,6 +1419,14 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1419 | 1419 | ||
1420 | mutex_lock(&priv->mutex); | 1420 | mutex_lock(&priv->mutex); |
1421 | 1421 | ||
1422 | if (changes & BSS_CHANGED_IDLE && bss_conf->idle) { | ||
1423 | /* | ||
1424 | * If we go idle, then clearly no "passive-no-rx" | ||
1425 | * workaround is needed any more, this is a reset. | ||
1426 | */ | ||
1427 | iwlagn_lift_passive_no_rx(priv); | ||
1428 | } | ||
1429 | |||
1422 | if (unlikely(!iwl_is_ready(priv))) { | 1430 | if (unlikely(!iwl_is_ready(priv))) { |
1423 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 1431 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
1424 | mutex_unlock(&priv->mutex); | 1432 | mutex_unlock(&priv->mutex); |
@@ -1450,16 +1458,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1450 | priv->timestamp = bss_conf->sync_tsf; | 1458 | priv->timestamp = bss_conf->sync_tsf; |
1451 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 1459 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
1452 | } else { | 1460 | } else { |
1453 | /* | ||
1454 | * If we disassociate while there are pending | ||
1455 | * frames, just wake up the queues and let the | ||
1456 | * frames "escape" ... This shouldn't really | ||
1457 | * be happening to start with, but we should | ||
1458 | * not get stuck in this case either since it | ||
1459 | * can happen if userspace gets confused. | ||
1460 | */ | ||
1461 | iwlagn_lift_passive_no_rx(priv); | ||
1462 | |||
1463 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1461 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1464 | 1462 | ||
1465 | if (ctx->ctxid == IWL_RXON_CTX_BSS) | 1463 | if (ctx->ctxid == IWL_RXON_CTX_BSS) |
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index 6aec2df3bb27..d1a670d7b10c 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -1192,7 +1192,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
1192 | memset(&info->status, 0, sizeof(info->status)); | 1192 | memset(&info->status, 0, sizeof(info->status)); |
1193 | 1193 | ||
1194 | if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && | 1194 | if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && |
1195 | iwl_is_associated_ctx(ctx) && ctx->vif && | 1195 | ctx->vif && |
1196 | ctx->vif->type == NL80211_IFTYPE_STATION) { | 1196 | ctx->vif->type == NL80211_IFTYPE_STATION) { |
1197 | /* block and stop all queues */ | 1197 | /* block and stop all queues */ |
1198 | priv->passive_no_rx = true; | 1198 | priv->passive_no_rx = true; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c index 736fe9bb140e..1a4ac9236a44 100644 --- a/drivers/net/wireless/iwlwifi/dvm/ucode.c +++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c | |||
@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
367 | return -EIO; | 367 | return -EIO; |
368 | } | 368 | } |
369 | 369 | ||
370 | priv->ucode_loaded = true; | ||
371 | |||
370 | if (ucode_type != IWL_UCODE_WOWLAN) { | 372 | if (ucode_type != IWL_UCODE_WOWLAN) { |
371 | /* delay a bit to give rfkill time to run */ | 373 | /* delay a bit to give rfkill time to run */ |
372 | msleep(5); | 374 | msleep(5); |
@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
380 | return ret; | 382 | return ret; |
381 | } | 383 | } |
382 | 384 | ||
383 | priv->ucode_loaded = true; | ||
384 | |||
385 | return 0; | 385 | return 0; |
386 | } | 386 | } |
387 | 387 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 17bedc50e753..12c4f31ca8fb 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -475,6 +475,10 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
475 | 475 | ||
476 | /* If platform's RF_KILL switch is NOT set to KILL */ | 476 | /* If platform's RF_KILL switch is NOT set to KILL */ |
477 | hw_rfkill = iwl_is_rfkill_set(trans); | 477 | hw_rfkill = iwl_is_rfkill_set(trans); |
478 | if (hw_rfkill) | ||
479 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
480 | else | ||
481 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
478 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 482 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
479 | if (hw_rfkill && !run_in_rfkill) | 483 | if (hw_rfkill && !run_in_rfkill) |
480 | return -ERFKILL; | 484 | return -ERFKILL; |
@@ -641,6 +645,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, | |||
641 | 645 | ||
642 | static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | 646 | static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) |
643 | { | 647 | { |
648 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
644 | bool hw_rfkill; | 649 | bool hw_rfkill; |
645 | int err; | 650 | int err; |
646 | 651 | ||
@@ -656,6 +661,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
656 | iwl_enable_rfkill_int(trans); | 661 | iwl_enable_rfkill_int(trans); |
657 | 662 | ||
658 | hw_rfkill = iwl_is_rfkill_set(trans); | 663 | hw_rfkill = iwl_is_rfkill_set(trans); |
664 | if (hw_rfkill) | ||
665 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
666 | else | ||
667 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
659 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 668 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
660 | 669 | ||
661 | return 0; | 670 | return 0; |
@@ -694,6 +703,10 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans, | |||
694 | * op_mode. | 703 | * op_mode. |
695 | */ | 704 | */ |
696 | hw_rfkill = iwl_is_rfkill_set(trans); | 705 | hw_rfkill = iwl_is_rfkill_set(trans); |
706 | if (hw_rfkill) | ||
707 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
708 | else | ||
709 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
697 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 710 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
698 | } | 711 | } |
699 | } | 712 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 8595c16f74de..cb5c6792e3a8 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -1264,7 +1264,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { | 1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1265 | int copy = 0; | 1265 | int copy = 0; |
1266 | 1266 | ||
1267 | if (!cmd->len) | 1267 | if (!cmd->len[i]) |
1268 | continue; | 1268 | continue; |
1269 | 1269 | ||
1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ | 1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index a44023a7bd57..8aaf56ade4d9 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1892,7 +1892,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1892 | } | 1892 | } |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | for (i = 0; i < request->n_channels; i++) { | 1895 | for (i = 0; i < min_t(u32, request->n_channels, |
1896 | MWIFIEX_USER_SCAN_CHAN_MAX); i++) { | ||
1896 | chan = request->channels[i]; | 1897 | chan = request->channels[i]; |
1897 | priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; | 1898 | priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; |
1898 | priv->user_scan_cfg->chan_list[i].radio_type = chan->band; | 1899 | priv->user_scan_cfg->chan_list[i].radio_type = chan->band; |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 20a6c5555873..b5c8b962ce12 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -157,6 +157,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
157 | return -1; | 157 | return -1; |
158 | } | 158 | } |
159 | 159 | ||
160 | cmd_code = le16_to_cpu(host_cmd->command); | ||
161 | cmd_size = le16_to_cpu(host_cmd->size); | ||
162 | |||
163 | if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && | ||
164 | cmd_code != HostCmd_CMD_FUNC_SHUTDOWN && | ||
165 | cmd_code != HostCmd_CMD_FUNC_INIT) { | ||
166 | dev_err(adapter->dev, | ||
167 | "DNLD_CMD: FW in reset state, ignore cmd %#x\n", | ||
168 | cmd_code); | ||
169 | mwifiex_complete_cmd(adapter, cmd_node); | ||
170 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); | ||
171 | return -1; | ||
172 | } | ||
173 | |||
160 | /* Set command sequence number */ | 174 | /* Set command sequence number */ |
161 | adapter->seq_num++; | 175 | adapter->seq_num++; |
162 | host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO | 176 | host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO |
@@ -168,9 +182,6 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
168 | adapter->curr_cmd = cmd_node; | 182 | adapter->curr_cmd = cmd_node; |
169 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | 183 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |
170 | 184 | ||
171 | cmd_code = le16_to_cpu(host_cmd->command); | ||
172 | cmd_size = le16_to_cpu(host_cmd->size); | ||
173 | |||
174 | /* Adjust skb length */ | 185 | /* Adjust skb length */ |
175 | if (cmd_node->cmd_skb->len > cmd_size) | 186 | if (cmd_node->cmd_skb->len > cmd_size) |
176 | /* | 187 | /* |
@@ -484,8 +495,6 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no, | |||
484 | 495 | ||
485 | ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, | 496 | ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, |
486 | data_buf); | 497 | data_buf); |
487 | if (!ret) | ||
488 | ret = mwifiex_wait_queue_complete(adapter); | ||
489 | 498 | ||
490 | return ret; | 499 | return ret; |
491 | } | 500 | } |
@@ -588,9 +597,10 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, | |||
588 | if (cmd_no == HostCmd_CMD_802_11_SCAN) { | 597 | if (cmd_no == HostCmd_CMD_802_11_SCAN) { |
589 | mwifiex_queue_scan_cmd(priv, cmd_node); | 598 | mwifiex_queue_scan_cmd(priv, cmd_node); |
590 | } else { | 599 | } else { |
591 | adapter->cmd_queued = cmd_node; | ||
592 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); | 600 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); |
593 | queue_work(adapter->workqueue, &adapter->main_work); | 601 | queue_work(adapter->workqueue, &adapter->main_work); |
602 | if (cmd_node->wait_q_enabled) | ||
603 | ret = mwifiex_wait_queue_complete(adapter, cmd_node); | ||
594 | } | 604 | } |
595 | 605 | ||
596 | return ret; | 606 | return ret; |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index e38aa9b3663d..0ff4c37ab42a 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -709,6 +709,14 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) | |||
709 | return ret; | 709 | return ret; |
710 | } | 710 | } |
711 | 711 | ||
712 | /* cancel current command */ | ||
713 | if (adapter->curr_cmd) { | ||
714 | dev_warn(adapter->dev, "curr_cmd is still in processing\n"); | ||
715 | del_timer(&adapter->cmd_timer); | ||
716 | mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); | ||
717 | adapter->curr_cmd = NULL; | ||
718 | } | ||
719 | |||
712 | /* shut down mwifiex */ | 720 | /* shut down mwifiex */ |
713 | dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); | 721 | dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); |
714 | 722 | ||
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 246aa62a4817..2fe0ceba4400 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1117,10 +1117,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
1117 | adhoc_join->bss_descriptor.bssid, | 1117 | adhoc_join->bss_descriptor.bssid, |
1118 | adhoc_join->bss_descriptor.ssid); | 1118 | adhoc_join->bss_descriptor.ssid); |
1119 | 1119 | ||
1120 | for (i = 0; bss_desc->supported_rates[i] && | 1120 | for (i = 0; i < MWIFIEX_SUPPORTED_RATES && |
1121 | i < MWIFIEX_SUPPORTED_RATES; | 1121 | bss_desc->supported_rates[i]; i++) |
1122 | i++) | 1122 | ; |
1123 | ; | ||
1124 | rates_size = i; | 1123 | rates_size = i; |
1125 | 1124 | ||
1126 | /* Copy Data Rates from the Rates recorded in scan response */ | 1125 | /* Copy Data Rates from the Rates recorded in scan response */ |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 553adfb0aa81..7035ade9af74 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -723,7 +723,6 @@ struct mwifiex_adapter { | |||
723 | u16 cmd_wait_q_required; | 723 | u16 cmd_wait_q_required; |
724 | struct mwifiex_wait_queue cmd_wait_q; | 724 | struct mwifiex_wait_queue cmd_wait_q; |
725 | u8 scan_wait_q_woken; | 725 | u8 scan_wait_q_woken; |
726 | struct cmd_ctrl_node *cmd_queued; | ||
727 | spinlock_t queue_lock; /* lock for tx queues */ | 726 | spinlock_t queue_lock; /* lock for tx queues */ |
728 | struct completion fw_load; | 727 | struct completion fw_load; |
729 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; | 728 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; |
@@ -1018,7 +1017,8 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, | |||
1018 | struct mwifiex_multicast_list *mcast_list); | 1017 | struct mwifiex_multicast_list *mcast_list); |
1019 | int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | 1018 | int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, |
1020 | struct net_device *dev); | 1019 | struct net_device *dev); |
1021 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter); | 1020 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, |
1021 | struct cmd_ctrl_node *cmd_queued); | ||
1022 | int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | 1022 | int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, |
1023 | struct cfg80211_ssid *req_ssid); | 1023 | struct cfg80211_ssid *req_ssid); |
1024 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); | 1024 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 5c395e2e6a2b..feb204613397 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -1508,6 +1508,7 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1508 | } | 1508 | } |
1509 | memcpy(adapter->upld_buf, skb->data, | 1509 | memcpy(adapter->upld_buf, skb->data, |
1510 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); | 1510 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); |
1511 | skb_push(skb, INTF_HEADER_LEN); | ||
1511 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, | 1512 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
1512 | PCI_DMA_FROMDEVICE)) | 1513 | PCI_DMA_FROMDEVICE)) |
1513 | return -1; | 1514 | return -1; |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index bb60c2754a97..e7f6deaf715e 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1388,10 +1388,15 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1388 | list_del(&cmd_node->list); | 1388 | list_del(&cmd_node->list); |
1389 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1389 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1390 | flags); | 1390 | flags); |
1391 | adapter->cmd_queued = cmd_node; | ||
1392 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, | 1391 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, |
1393 | true); | 1392 | true); |
1394 | queue_work(adapter->workqueue, &adapter->main_work); | 1393 | queue_work(adapter->workqueue, &adapter->main_work); |
1394 | |||
1395 | /* Perform internal scan synchronously */ | ||
1396 | if (!priv->scan_request) { | ||
1397 | dev_dbg(adapter->dev, "wait internal scan\n"); | ||
1398 | mwifiex_wait_queue_complete(adapter, cmd_node); | ||
1399 | } | ||
1395 | } else { | 1400 | } else { |
1396 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1401 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1397 | flags); | 1402 | flags); |
@@ -1790,7 +1795,12 @@ check_next_scan: | |||
1790 | /* Need to indicate IOCTL complete */ | 1795 | /* Need to indicate IOCTL complete */ |
1791 | if (adapter->curr_cmd->wait_q_enabled) { | 1796 | if (adapter->curr_cmd->wait_q_enabled) { |
1792 | adapter->cmd_wait_q.status = 0; | 1797 | adapter->cmd_wait_q.status = 0; |
1793 | mwifiex_complete_cmd(adapter, adapter->curr_cmd); | 1798 | if (!priv->scan_request) { |
1799 | dev_dbg(adapter->dev, | ||
1800 | "complete internal scan\n"); | ||
1801 | mwifiex_complete_cmd(adapter, | ||
1802 | adapter->curr_cmd); | ||
1803 | } | ||
1794 | } | 1804 | } |
1795 | if (priv->report_scan_result) | 1805 | if (priv->report_scan_result) |
1796 | priv->report_scan_result = false; | 1806 | priv->report_scan_result = false; |
@@ -1946,9 +1956,6 @@ int mwifiex_request_scan(struct mwifiex_private *priv, | |||
1946 | /* Normal scan */ | 1956 | /* Normal scan */ |
1947 | ret = mwifiex_scan_networks(priv, NULL); | 1957 | ret = mwifiex_scan_networks(priv, NULL); |
1948 | 1958 | ||
1949 | if (!ret) | ||
1950 | ret = mwifiex_wait_queue_complete(priv->adapter); | ||
1951 | |||
1952 | up(&priv->async_sem); | 1959 | up(&priv->async_sem); |
1953 | 1960 | ||
1954 | return ret; | 1961 | return ret; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 9f33c92c90f5..13100f8de3db 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -54,16 +54,10 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | |||
54 | * This function waits on a cmd wait queue. It also cancels the pending | 54 | * This function waits on a cmd wait queue. It also cancels the pending |
55 | * request after waking up, in case of errors. | 55 | * request after waking up, in case of errors. |
56 | */ | 56 | */ |
57 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) | 57 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, |
58 | struct cmd_ctrl_node *cmd_queued) | ||
58 | { | 59 | { |
59 | int status; | 60 | int status; |
60 | struct cmd_ctrl_node *cmd_queued; | ||
61 | |||
62 | if (!adapter->cmd_queued) | ||
63 | return 0; | ||
64 | |||
65 | cmd_queued = adapter->cmd_queued; | ||
66 | adapter->cmd_queued = NULL; | ||
67 | 61 | ||
68 | dev_dbg(adapter->dev, "cmd pending\n"); | 62 | dev_dbg(adapter->dev, "cmd pending\n"); |
69 | atomic_inc(&adapter->cmd_pending); | 63 | atomic_inc(&adapter->cmd_pending); |
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 44d6ead43341..76cd47eb901e 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -20,6 +20,7 @@ if RT2X00 | |||
20 | config RT2400PCI | 20 | config RT2400PCI |
21 | tristate "Ralink rt2400 (PCI/PCMCIA) support" | 21 | tristate "Ralink rt2400 (PCI/PCMCIA) support" |
22 | depends on PCI | 22 | depends on PCI |
23 | select RT2X00_LIB_MMIO | ||
23 | select RT2X00_LIB_PCI | 24 | select RT2X00_LIB_PCI |
24 | select EEPROM_93CX6 | 25 | select EEPROM_93CX6 |
25 | ---help--- | 26 | ---help--- |
@@ -31,6 +32,7 @@ config RT2400PCI | |||
31 | config RT2500PCI | 32 | config RT2500PCI |
32 | tristate "Ralink rt2500 (PCI/PCMCIA) support" | 33 | tristate "Ralink rt2500 (PCI/PCMCIA) support" |
33 | depends on PCI | 34 | depends on PCI |
35 | select RT2X00_LIB_MMIO | ||
34 | select RT2X00_LIB_PCI | 36 | select RT2X00_LIB_PCI |
35 | select EEPROM_93CX6 | 37 | select EEPROM_93CX6 |
36 | ---help--- | 38 | ---help--- |
@@ -43,6 +45,7 @@ config RT61PCI | |||
43 | tristate "Ralink rt2501/rt61 (PCI/PCMCIA) support" | 45 | tristate "Ralink rt2501/rt61 (PCI/PCMCIA) support" |
44 | depends on PCI | 46 | depends on PCI |
45 | select RT2X00_LIB_PCI | 47 | select RT2X00_LIB_PCI |
48 | select RT2X00_LIB_MMIO | ||
46 | select RT2X00_LIB_FIRMWARE | 49 | select RT2X00_LIB_FIRMWARE |
47 | select RT2X00_LIB_CRYPTO | 50 | select RT2X00_LIB_CRYPTO |
48 | select CRC_ITU_T | 51 | select CRC_ITU_T |
@@ -55,10 +58,11 @@ config RT61PCI | |||
55 | 58 | ||
56 | config RT2800PCI | 59 | config RT2800PCI |
57 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" | 60 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" |
58 | depends on PCI || RALINK_RT288X || RALINK_RT305X | 61 | depends on PCI || SOC_RT288X || SOC_RT305X |
59 | select RT2800_LIB | 62 | select RT2800_LIB |
63 | select RT2X00_LIB_MMIO | ||
60 | select RT2X00_LIB_PCI if PCI | 64 | select RT2X00_LIB_PCI if PCI |
61 | select RT2X00_LIB_SOC if RALINK_RT288X || RALINK_RT305X | 65 | select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X |
62 | select RT2X00_LIB_FIRMWARE | 66 | select RT2X00_LIB_FIRMWARE |
63 | select RT2X00_LIB_CRYPTO | 67 | select RT2X00_LIB_CRYPTO |
64 | select CRC_CCITT | 68 | select CRC_CCITT |
@@ -185,6 +189,9 @@ endif | |||
185 | config RT2800_LIB | 189 | config RT2800_LIB |
186 | tristate | 190 | tristate |
187 | 191 | ||
192 | config RT2X00_LIB_MMIO | ||
193 | tristate | ||
194 | |||
188 | config RT2X00_LIB_PCI | 195 | config RT2X00_LIB_PCI |
189 | tristate | 196 | tristate |
190 | select RT2X00_LIB | 197 | select RT2X00_LIB |
diff --git a/drivers/net/wireless/rt2x00/Makefile b/drivers/net/wireless/rt2x00/Makefile index 349d5b8284a4..f069d8bc5b67 100644 --- a/drivers/net/wireless/rt2x00/Makefile +++ b/drivers/net/wireless/rt2x00/Makefile | |||
@@ -9,6 +9,7 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o | |||
9 | rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o | 9 | rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o |
10 | 10 | ||
11 | obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o | 11 | obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o |
12 | obj-$(CONFIG_RT2X00_LIB_MMIO) += rt2x00mmio.o | ||
12 | obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o | 13 | obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o |
13 | obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o | 14 | obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o |
14 | obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o | 15 | obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 221beaaa83f1..dcfb54e0c516 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | 35 | ||
36 | #include "rt2x00.h" | 36 | #include "rt2x00.h" |
37 | #include "rt2x00mmio.h" | ||
37 | #include "rt2x00pci.h" | 38 | #include "rt2x00pci.h" |
38 | #include "rt2400pci.h" | 39 | #include "rt2400pci.h" |
39 | 40 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 39edc59e8d03..e1d2dc9ed28a 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | 35 | ||
36 | #include "rt2x00.h" | 36 | #include "rt2x00.h" |
37 | #include "rt2x00mmio.h" | ||
37 | #include "rt2x00pci.h" | 38 | #include "rt2x00pci.h" |
38 | #include "rt2500pci.h" | 39 | #include "rt2500pci.h" |
39 | 40 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 48a01aa21f1c..ba5a05625aaa 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/eeprom_93cx6.h> | 41 | #include <linux/eeprom_93cx6.h> |
42 | 42 | ||
43 | #include "rt2x00.h" | 43 | #include "rt2x00.h" |
44 | #include "rt2x00mmio.h" | ||
44 | #include "rt2x00pci.h" | 45 | #include "rt2x00pci.h" |
45 | #include "rt2x00soc.h" | 46 | #include "rt2x00soc.h" |
46 | #include "rt2800lib.h" | 47 | #include "rt2800lib.h" |
@@ -89,7 +90,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) | |||
89 | rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 90 | rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
90 | } | 91 | } |
91 | 92 | ||
92 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 93 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
93 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 94 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
94 | { | 95 | { |
95 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | 96 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); |
@@ -107,7 +108,7 @@ static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | |||
107 | { | 108 | { |
108 | return -ENOMEM; | 109 | return -ENOMEM; |
109 | } | 110 | } |
110 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 111 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ |
111 | 112 | ||
112 | #ifdef CONFIG_PCI | 113 | #ifdef CONFIG_PCI |
113 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) | 114 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) |
@@ -1177,7 +1178,7 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | |||
1177 | #endif /* CONFIG_PCI */ | 1178 | #endif /* CONFIG_PCI */ |
1178 | MODULE_LICENSE("GPL"); | 1179 | MODULE_LICENSE("GPL"); |
1179 | 1180 | ||
1180 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1181 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1181 | static int rt2800soc_probe(struct platform_device *pdev) | 1182 | static int rt2800soc_probe(struct platform_device *pdev) |
1182 | { | 1183 | { |
1183 | return rt2x00soc_probe(pdev, &rt2800pci_ops); | 1184 | return rt2x00soc_probe(pdev, &rt2800pci_ops); |
@@ -1194,7 +1195,7 @@ static struct platform_driver rt2800soc_driver = { | |||
1194 | .suspend = rt2x00soc_suspend, | 1195 | .suspend = rt2x00soc_suspend, |
1195 | .resume = rt2x00soc_resume, | 1196 | .resume = rt2x00soc_resume, |
1196 | }; | 1197 | }; |
1197 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 1198 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ |
1198 | 1199 | ||
1199 | #ifdef CONFIG_PCI | 1200 | #ifdef CONFIG_PCI |
1200 | static int rt2800pci_probe(struct pci_dev *pci_dev, | 1201 | static int rt2800pci_probe(struct pci_dev *pci_dev, |
@@ -1217,7 +1218,7 @@ static int __init rt2800pci_init(void) | |||
1217 | { | 1218 | { |
1218 | int ret = 0; | 1219 | int ret = 0; |
1219 | 1220 | ||
1220 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1221 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1221 | ret = platform_driver_register(&rt2800soc_driver); | 1222 | ret = platform_driver_register(&rt2800soc_driver); |
1222 | if (ret) | 1223 | if (ret) |
1223 | return ret; | 1224 | return ret; |
@@ -1225,7 +1226,7 @@ static int __init rt2800pci_init(void) | |||
1225 | #ifdef CONFIG_PCI | 1226 | #ifdef CONFIG_PCI |
1226 | ret = pci_register_driver(&rt2800pci_driver); | 1227 | ret = pci_register_driver(&rt2800pci_driver); |
1227 | if (ret) { | 1228 | if (ret) { |
1228 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1229 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1229 | platform_driver_unregister(&rt2800soc_driver); | 1230 | platform_driver_unregister(&rt2800soc_driver); |
1230 | #endif | 1231 | #endif |
1231 | return ret; | 1232 | return ret; |
@@ -1240,7 +1241,7 @@ static void __exit rt2800pci_exit(void) | |||
1240 | #ifdef CONFIG_PCI | 1241 | #ifdef CONFIG_PCI |
1241 | pci_unregister_driver(&rt2800pci_driver); | 1242 | pci_unregister_driver(&rt2800pci_driver); |
1242 | #endif | 1243 | #endif |
1243 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1244 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1244 | platform_driver_unregister(&rt2800soc_driver); | 1245 | platform_driver_unregister(&rt2800soc_driver); |
1245 | #endif | 1246 | #endif |
1246 | } | 1247 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.c b/drivers/net/wireless/rt2x00/rt2x00mmio.c new file mode 100644 index 000000000000..d84a680ba0c9 --- /dev/null +++ b/drivers/net/wireless/rt2x00/rt2x00mmio.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> | ||
3 | <http://rt2x00.serialmonkey.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the | ||
17 | Free Software Foundation, Inc., | ||
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Module: rt2x00mmio | ||
23 | Abstract: rt2x00 generic mmio device routines. | ||
24 | */ | ||
25 | |||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/slab.h> | ||
30 | |||
31 | #include "rt2x00.h" | ||
32 | #include "rt2x00mmio.h" | ||
33 | |||
34 | /* | ||
35 | * Register access. | ||
36 | */ | ||
37 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
38 | const unsigned int offset, | ||
39 | const struct rt2x00_field32 field, | ||
40 | u32 *reg) | ||
41 | { | ||
42 | unsigned int i; | ||
43 | |||
44 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
45 | return 0; | ||
46 | |||
47 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
48 | rt2x00pci_register_read(rt2x00dev, offset, reg); | ||
49 | if (!rt2x00_get_field32(*reg, field)) | ||
50 | return 1; | ||
51 | udelay(REGISTER_BUSY_DELAY); | ||
52 | } | ||
53 | |||
54 | printk_once(KERN_ERR "%s() Indirect register access failed: " | ||
55 | "offset=0x%.08x, value=0x%.08x\n", __func__, offset, *reg); | ||
56 | *reg = ~0; | ||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); | ||
61 | |||
62 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | ||
63 | { | ||
64 | struct data_queue *queue = rt2x00dev->rx; | ||
65 | struct queue_entry *entry; | ||
66 | struct queue_entry_priv_pci *entry_priv; | ||
67 | struct skb_frame_desc *skbdesc; | ||
68 | int max_rx = 16; | ||
69 | |||
70 | while (--max_rx) { | ||
71 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
72 | entry_priv = entry->priv_data; | ||
73 | |||
74 | if (rt2x00dev->ops->lib->get_entry_state(entry)) | ||
75 | break; | ||
76 | |||
77 | /* | ||
78 | * Fill in desc fields of the skb descriptor | ||
79 | */ | ||
80 | skbdesc = get_skb_frame_desc(entry->skb); | ||
81 | skbdesc->desc = entry_priv->desc; | ||
82 | skbdesc->desc_len = entry->queue->desc_size; | ||
83 | |||
84 | /* | ||
85 | * DMA is already done, notify rt2x00lib that | ||
86 | * it finished successfully. | ||
87 | */ | ||
88 | rt2x00lib_dmastart(entry); | ||
89 | rt2x00lib_dmadone(entry); | ||
90 | |||
91 | /* | ||
92 | * Send the frame to rt2x00lib for further processing. | ||
93 | */ | ||
94 | rt2x00lib_rxdone(entry, GFP_ATOMIC); | ||
95 | } | ||
96 | |||
97 | return !max_rx; | ||
98 | } | ||
99 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | ||
100 | |||
101 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) | ||
102 | { | ||
103 | unsigned int i; | ||
104 | |||
105 | for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) | ||
106 | msleep(10); | ||
107 | } | ||
108 | EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); | ||
109 | |||
110 | /* | ||
111 | * Device initialization handlers. | ||
112 | */ | ||
113 | static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
114 | struct data_queue *queue) | ||
115 | { | ||
116 | struct queue_entry_priv_pci *entry_priv; | ||
117 | void *addr; | ||
118 | dma_addr_t dma; | ||
119 | unsigned int i; | ||
120 | |||
121 | /* | ||
122 | * Allocate DMA memory for descriptor and buffer. | ||
123 | */ | ||
124 | addr = dma_alloc_coherent(rt2x00dev->dev, | ||
125 | queue->limit * queue->desc_size, | ||
126 | &dma, GFP_KERNEL); | ||
127 | if (!addr) | ||
128 | return -ENOMEM; | ||
129 | |||
130 | memset(addr, 0, queue->limit * queue->desc_size); | ||
131 | |||
132 | /* | ||
133 | * Initialize all queue entries to contain valid addresses. | ||
134 | */ | ||
135 | for (i = 0; i < queue->limit; i++) { | ||
136 | entry_priv = queue->entries[i].priv_data; | ||
137 | entry_priv->desc = addr + i * queue->desc_size; | ||
138 | entry_priv->desc_dma = dma + i * queue->desc_size; | ||
139 | } | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
145 | struct data_queue *queue) | ||
146 | { | ||
147 | struct queue_entry_priv_pci *entry_priv = | ||
148 | queue->entries[0].priv_data; | ||
149 | |||
150 | if (entry_priv->desc) | ||
151 | dma_free_coherent(rt2x00dev->dev, | ||
152 | queue->limit * queue->desc_size, | ||
153 | entry_priv->desc, entry_priv->desc_dma); | ||
154 | entry_priv->desc = NULL; | ||
155 | } | ||
156 | |||
157 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) | ||
158 | { | ||
159 | struct data_queue *queue; | ||
160 | int status; | ||
161 | |||
162 | /* | ||
163 | * Allocate DMA | ||
164 | */ | ||
165 | queue_for_each(rt2x00dev, queue) { | ||
166 | status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); | ||
167 | if (status) | ||
168 | goto exit; | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * Register interrupt handler. | ||
173 | */ | ||
174 | status = request_irq(rt2x00dev->irq, | ||
175 | rt2x00dev->ops->lib->irq_handler, | ||
176 | IRQF_SHARED, rt2x00dev->name, rt2x00dev); | ||
177 | if (status) { | ||
178 | ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", | ||
179 | rt2x00dev->irq, status); | ||
180 | goto exit; | ||
181 | } | ||
182 | |||
183 | return 0; | ||
184 | |||
185 | exit: | ||
186 | queue_for_each(rt2x00dev, queue) | ||
187 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
188 | |||
189 | return status; | ||
190 | } | ||
191 | EXPORT_SYMBOL_GPL(rt2x00pci_initialize); | ||
192 | |||
193 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) | ||
194 | { | ||
195 | struct data_queue *queue; | ||
196 | |||
197 | /* | ||
198 | * Free irq line. | ||
199 | */ | ||
200 | free_irq(rt2x00dev->irq, rt2x00dev); | ||
201 | |||
202 | /* | ||
203 | * Free DMA | ||
204 | */ | ||
205 | queue_for_each(rt2x00dev, queue) | ||
206 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
207 | } | ||
208 | EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); | ||
209 | |||
210 | /* | ||
211 | * rt2x00mmio module information. | ||
212 | */ | ||
213 | MODULE_AUTHOR(DRV_PROJECT); | ||
214 | MODULE_VERSION(DRV_VERSION); | ||
215 | MODULE_DESCRIPTION("rt2x00 mmio library"); | ||
216 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.h b/drivers/net/wireless/rt2x00/rt2x00mmio.h new file mode 100644 index 000000000000..4ecaf60175bf --- /dev/null +++ b/drivers/net/wireless/rt2x00/rt2x00mmio.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> | ||
3 | <http://rt2x00.serialmonkey.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the | ||
17 | Free Software Foundation, Inc., | ||
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Module: rt2x00mmio | ||
23 | Abstract: Data structures for the rt2x00mmio module. | ||
24 | */ | ||
25 | |||
26 | #ifndef RT2X00MMIO_H | ||
27 | #define RT2X00MMIO_H | ||
28 | |||
29 | #include <linux/io.h> | ||
30 | |||
31 | /* | ||
32 | * Register access. | ||
33 | */ | ||
34 | static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, | ||
35 | const unsigned int offset, | ||
36 | u32 *value) | ||
37 | { | ||
38 | *value = readl(rt2x00dev->csr.base + offset); | ||
39 | } | ||
40 | |||
41 | static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | void *value, const u32 length) | ||
44 | { | ||
45 | memcpy_fromio(value, rt2x00dev->csr.base + offset, length); | ||
46 | } | ||
47 | |||
48 | static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, | ||
49 | const unsigned int offset, | ||
50 | u32 value) | ||
51 | { | ||
52 | writel(value, rt2x00dev->csr.base + offset); | ||
53 | } | ||
54 | |||
55 | static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
56 | const unsigned int offset, | ||
57 | const void *value, | ||
58 | const u32 length) | ||
59 | { | ||
60 | __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * rt2x00pci_regbusy_read - Read from register with busy check | ||
65 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
66 | * @offset: Register offset | ||
67 | * @field: Field to check if register is busy | ||
68 | * @reg: Pointer to where register contents should be stored | ||
69 | * | ||
70 | * This function will read the given register, and checks if the | ||
71 | * register is busy. If it is, it will sleep for a couple of | ||
72 | * microseconds before reading the register again. If the register | ||
73 | * is not read after a certain timeout, this function will return | ||
74 | * FALSE. | ||
75 | */ | ||
76 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
77 | const unsigned int offset, | ||
78 | const struct rt2x00_field32 field, | ||
79 | u32 *reg); | ||
80 | |||
81 | /** | ||
82 | * struct queue_entry_priv_pci: Per entry PCI specific information | ||
83 | * | ||
84 | * @desc: Pointer to device descriptor | ||
85 | * @desc_dma: DMA pointer to &desc. | ||
86 | * @data: Pointer to device's entry memory. | ||
87 | * @data_dma: DMA pointer to &data. | ||
88 | */ | ||
89 | struct queue_entry_priv_pci { | ||
90 | __le32 *desc; | ||
91 | dma_addr_t desc_dma; | ||
92 | }; | ||
93 | |||
94 | /** | ||
95 | * rt2x00pci_rxdone - Handle RX done events | ||
96 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
97 | * | ||
98 | * Returns true if there are still rx frames pending and false if all | ||
99 | * pending rx frames were processed. | ||
100 | */ | ||
101 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); | ||
102 | |||
103 | /** | ||
104 | * rt2x00pci_flush_queue - Flush data queue | ||
105 | * @queue: Data queue to stop | ||
106 | * @drop: True to drop all pending frames. | ||
107 | * | ||
108 | * This will wait for a maximum of 100ms, waiting for the queues | ||
109 | * to become empty. | ||
110 | */ | ||
111 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); | ||
112 | |||
113 | /* | ||
114 | * Device initialization handlers. | ||
115 | */ | ||
116 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); | ||
117 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); | ||
118 | |||
119 | #endif /* RT2X00MMIO_H */ | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index a0c8caef3b0a..e87865e33113 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -33,182 +33,6 @@ | |||
33 | #include "rt2x00pci.h" | 33 | #include "rt2x00pci.h" |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Register access. | ||
37 | */ | ||
38 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
39 | const unsigned int offset, | ||
40 | const struct rt2x00_field32 field, | ||
41 | u32 *reg) | ||
42 | { | ||
43 | unsigned int i; | ||
44 | |||
45 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
46 | return 0; | ||
47 | |||
48 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
49 | rt2x00pci_register_read(rt2x00dev, offset, reg); | ||
50 | if (!rt2x00_get_field32(*reg, field)) | ||
51 | return 1; | ||
52 | udelay(REGISTER_BUSY_DELAY); | ||
53 | } | ||
54 | |||
55 | ERROR(rt2x00dev, "Indirect register access failed: " | ||
56 | "offset=0x%.08x, value=0x%.08x\n", offset, *reg); | ||
57 | *reg = ~0; | ||
58 | |||
59 | return 0; | ||
60 | } | ||
61 | EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); | ||
62 | |||
63 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | ||
64 | { | ||
65 | struct data_queue *queue = rt2x00dev->rx; | ||
66 | struct queue_entry *entry; | ||
67 | struct queue_entry_priv_pci *entry_priv; | ||
68 | struct skb_frame_desc *skbdesc; | ||
69 | int max_rx = 16; | ||
70 | |||
71 | while (--max_rx) { | ||
72 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
73 | entry_priv = entry->priv_data; | ||
74 | |||
75 | if (rt2x00dev->ops->lib->get_entry_state(entry)) | ||
76 | break; | ||
77 | |||
78 | /* | ||
79 | * Fill in desc fields of the skb descriptor | ||
80 | */ | ||
81 | skbdesc = get_skb_frame_desc(entry->skb); | ||
82 | skbdesc->desc = entry_priv->desc; | ||
83 | skbdesc->desc_len = entry->queue->desc_size; | ||
84 | |||
85 | /* | ||
86 | * DMA is already done, notify rt2x00lib that | ||
87 | * it finished successfully. | ||
88 | */ | ||
89 | rt2x00lib_dmastart(entry); | ||
90 | rt2x00lib_dmadone(entry); | ||
91 | |||
92 | /* | ||
93 | * Send the frame to rt2x00lib for further processing. | ||
94 | */ | ||
95 | rt2x00lib_rxdone(entry, GFP_ATOMIC); | ||
96 | } | ||
97 | |||
98 | return !max_rx; | ||
99 | } | ||
100 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | ||
101 | |||
102 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) | ||
103 | { | ||
104 | unsigned int i; | ||
105 | |||
106 | for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) | ||
107 | msleep(10); | ||
108 | } | ||
109 | EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); | ||
110 | |||
111 | /* | ||
112 | * Device initialization handlers. | ||
113 | */ | ||
114 | static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
115 | struct data_queue *queue) | ||
116 | { | ||
117 | struct queue_entry_priv_pci *entry_priv; | ||
118 | void *addr; | ||
119 | dma_addr_t dma; | ||
120 | unsigned int i; | ||
121 | |||
122 | /* | ||
123 | * Allocate DMA memory for descriptor and buffer. | ||
124 | */ | ||
125 | addr = dma_alloc_coherent(rt2x00dev->dev, | ||
126 | queue->limit * queue->desc_size, | ||
127 | &dma, GFP_KERNEL); | ||
128 | if (!addr) | ||
129 | return -ENOMEM; | ||
130 | |||
131 | memset(addr, 0, queue->limit * queue->desc_size); | ||
132 | |||
133 | /* | ||
134 | * Initialize all queue entries to contain valid addresses. | ||
135 | */ | ||
136 | for (i = 0; i < queue->limit; i++) { | ||
137 | entry_priv = queue->entries[i].priv_data; | ||
138 | entry_priv->desc = addr + i * queue->desc_size; | ||
139 | entry_priv->desc_dma = dma + i * queue->desc_size; | ||
140 | } | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
146 | struct data_queue *queue) | ||
147 | { | ||
148 | struct queue_entry_priv_pci *entry_priv = | ||
149 | queue->entries[0].priv_data; | ||
150 | |||
151 | if (entry_priv->desc) | ||
152 | dma_free_coherent(rt2x00dev->dev, | ||
153 | queue->limit * queue->desc_size, | ||
154 | entry_priv->desc, entry_priv->desc_dma); | ||
155 | entry_priv->desc = NULL; | ||
156 | } | ||
157 | |||
158 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) | ||
159 | { | ||
160 | struct data_queue *queue; | ||
161 | int status; | ||
162 | |||
163 | /* | ||
164 | * Allocate DMA | ||
165 | */ | ||
166 | queue_for_each(rt2x00dev, queue) { | ||
167 | status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); | ||
168 | if (status) | ||
169 | goto exit; | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * Register interrupt handler. | ||
174 | */ | ||
175 | status = request_irq(rt2x00dev->irq, | ||
176 | rt2x00dev->ops->lib->irq_handler, | ||
177 | IRQF_SHARED, rt2x00dev->name, rt2x00dev); | ||
178 | if (status) { | ||
179 | ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", | ||
180 | rt2x00dev->irq, status); | ||
181 | goto exit; | ||
182 | } | ||
183 | |||
184 | return 0; | ||
185 | |||
186 | exit: | ||
187 | queue_for_each(rt2x00dev, queue) | ||
188 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
189 | |||
190 | return status; | ||
191 | } | ||
192 | EXPORT_SYMBOL_GPL(rt2x00pci_initialize); | ||
193 | |||
194 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) | ||
195 | { | ||
196 | struct data_queue *queue; | ||
197 | |||
198 | /* | ||
199 | * Free irq line. | ||
200 | */ | ||
201 | free_irq(rt2x00dev->irq, rt2x00dev); | ||
202 | |||
203 | /* | ||
204 | * Free DMA | ||
205 | */ | ||
206 | queue_for_each(rt2x00dev, queue) | ||
207 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
208 | } | ||
209 | EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); | ||
210 | |||
211 | /* | ||
212 | * PCI driver handlers. | 36 | * PCI driver handlers. |
213 | */ | 37 | */ |
214 | static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev) | 38 | static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h index e2c99f2b9a14..60d90b20f8b9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.h +++ b/drivers/net/wireless/rt2x00/rt2x00pci.h | |||
@@ -36,94 +36,6 @@ | |||
36 | #define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) | 36 | #define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Register access. | ||
40 | */ | ||
41 | static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | u32 *value) | ||
44 | { | ||
45 | *value = readl(rt2x00dev->csr.base + offset); | ||
46 | } | ||
47 | |||
48 | static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
49 | const unsigned int offset, | ||
50 | void *value, const u32 length) | ||
51 | { | ||
52 | memcpy_fromio(value, rt2x00dev->csr.base + offset, length); | ||
53 | } | ||
54 | |||
55 | static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, | ||
56 | const unsigned int offset, | ||
57 | u32 value) | ||
58 | { | ||
59 | writel(value, rt2x00dev->csr.base + offset); | ||
60 | } | ||
61 | |||
62 | static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
63 | const unsigned int offset, | ||
64 | const void *value, | ||
65 | const u32 length) | ||
66 | { | ||
67 | __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * rt2x00pci_regbusy_read - Read from register with busy check | ||
72 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
73 | * @offset: Register offset | ||
74 | * @field: Field to check if register is busy | ||
75 | * @reg: Pointer to where register contents should be stored | ||
76 | * | ||
77 | * This function will read the given register, and checks if the | ||
78 | * register is busy. If it is, it will sleep for a couple of | ||
79 | * microseconds before reading the register again. If the register | ||
80 | * is not read after a certain timeout, this function will return | ||
81 | * FALSE. | ||
82 | */ | ||
83 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
84 | const unsigned int offset, | ||
85 | const struct rt2x00_field32 field, | ||
86 | u32 *reg); | ||
87 | |||
88 | /** | ||
89 | * struct queue_entry_priv_pci: Per entry PCI specific information | ||
90 | * | ||
91 | * @desc: Pointer to device descriptor | ||
92 | * @desc_dma: DMA pointer to &desc. | ||
93 | * @data: Pointer to device's entry memory. | ||
94 | * @data_dma: DMA pointer to &data. | ||
95 | */ | ||
96 | struct queue_entry_priv_pci { | ||
97 | __le32 *desc; | ||
98 | dma_addr_t desc_dma; | ||
99 | }; | ||
100 | |||
101 | /** | ||
102 | * rt2x00pci_rxdone - Handle RX done events | ||
103 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
104 | * | ||
105 | * Returns true if there are still rx frames pending and false if all | ||
106 | * pending rx frames were processed. | ||
107 | */ | ||
108 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); | ||
109 | |||
110 | /** | ||
111 | * rt2x00pci_flush_queue - Flush data queue | ||
112 | * @queue: Data queue to stop | ||
113 | * @drop: True to drop all pending frames. | ||
114 | * | ||
115 | * This will wait for a maximum of 100ms, waiting for the queues | ||
116 | * to become empty. | ||
117 | */ | ||
118 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); | ||
119 | |||
120 | /* | ||
121 | * Device initialization handlers. | ||
122 | */ | ||
123 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); | ||
124 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); | ||
125 | |||
126 | /* | ||
127 | * PCI driver handlers. | 39 | * PCI driver handlers. |
128 | */ | 40 | */ |
129 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); | 41 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index f95792cfcf89..9e3c8ff53e3f 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/eeprom_93cx6.h> | 35 | #include <linux/eeprom_93cx6.h> |
36 | 36 | ||
37 | #include "rt2x00.h" | 37 | #include "rt2x00.h" |
38 | #include "rt2x00mmio.h" | ||
38 | #include "rt2x00pci.h" | 39 | #include "rt2x00pci.h" |
39 | #include "rt61pci.h" | 40 | #include "rt61pci.h" |
40 | 41 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index b1ccff474c79..c08d0f4c5f3d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -1377,74 +1377,57 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw) | |||
1377 | 1377 | ||
1378 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) | 1378 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) |
1379 | { | 1379 | { |
1380 | /* dummy routine needed for callback from rtl_op_configure_filter() */ | ||
1381 | } | ||
1382 | |||
1383 | /*========================================================================== */ | ||
1384 | |||
1385 | static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw, | ||
1386 | enum nl80211_iftype type) | ||
1387 | { | ||
1388 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1380 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1389 | u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); | ||
1390 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); | 1381 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
1391 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1382 | u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
1392 | u8 filterout_non_associated_bssid = false; | ||
1393 | 1383 | ||
1394 | switch (type) { | 1384 | if (rtlpriv->psc.rfpwr_state != ERFON) |
1395 | case NL80211_IFTYPE_ADHOC: | 1385 | return; |
1396 | case NL80211_IFTYPE_STATION: | 1386 | |
1397 | filterout_non_associated_bssid = true; | 1387 | if (check_bssid) { |
1398 | break; | 1388 | u8 tmp; |
1399 | case NL80211_IFTYPE_UNSPECIFIED: | ||
1400 | case NL80211_IFTYPE_AP: | ||
1401 | default: | ||
1402 | break; | ||
1403 | } | ||
1404 | if (filterout_non_associated_bssid) { | ||
1405 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1389 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1406 | switch (rtlphy->current_io_type) { | 1390 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1407 | case IO_CMD_RESUME_DM_BY_SCAN: | 1391 | tmp = BIT(4); |
1408 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); | ||
1409 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1410 | HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1411 | /* enable update TSF */ | ||
1412 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); | ||
1413 | break; | ||
1414 | case IO_CMD_PAUSE_DM_BY_SCAN: | ||
1415 | reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); | ||
1416 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1417 | HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1418 | /* disable update TSF */ | ||
1419 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); | ||
1420 | break; | ||
1421 | } | ||
1422 | } else { | 1392 | } else { |
1423 | reg_rcr |= (RCR_CBSSID); | 1393 | reg_rcr |= RCR_CBSSID; |
1424 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1394 | tmp = BIT(4) | BIT(5); |
1425 | (u8 *)(®_rcr)); | ||
1426 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, (BIT(4)|BIT(5))); | ||
1427 | } | 1395 | } |
1428 | } else if (filterout_non_associated_bssid == false) { | 1396 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
1397 | (u8 *) (®_rcr)); | ||
1398 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp); | ||
1399 | } else { | ||
1400 | u8 tmp; | ||
1429 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1401 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1430 | reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); | 1402 | reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1431 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1403 | tmp = BIT(4); |
1432 | (u8 *)(®_rcr)); | ||
1433 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); | ||
1434 | } else { | 1404 | } else { |
1435 | reg_rcr &= (~RCR_CBSSID); | 1405 | reg_rcr &= ~RCR_CBSSID; |
1436 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1406 | tmp = BIT(4) | BIT(5); |
1437 | (u8 *)(®_rcr)); | ||
1438 | _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4)|BIT(5)), 0); | ||
1439 | } | 1407 | } |
1408 | reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); | ||
1409 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1410 | HW_VAR_RCR, (u8 *) (®_rcr)); | ||
1411 | _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0); | ||
1440 | } | 1412 | } |
1441 | } | 1413 | } |
1442 | 1414 | ||
1415 | /*========================================================================== */ | ||
1416 | |||
1443 | int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) | 1417 | int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) |
1444 | { | 1418 | { |
1419 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1420 | |||
1445 | if (_rtl92cu_set_media_status(hw, type)) | 1421 | if (_rtl92cu_set_media_status(hw, type)) |
1446 | return -EOPNOTSUPP; | 1422 | return -EOPNOTSUPP; |
1447 | _rtl92cu_set_check_bssid(hw, type); | 1423 | |
1424 | if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { | ||
1425 | if (type != NL80211_IFTYPE_AP) | ||
1426 | rtl92cu_set_check_bssid(hw, true); | ||
1427 | } else { | ||
1428 | rtl92cu_set_check_bssid(hw, false); | ||
1429 | } | ||
1430 | |||
1448 | return 0; | 1431 | return 0; |
1449 | } | 1432 | } |
1450 | 1433 | ||
@@ -2058,8 +2041,6 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2058 | (shortgi_rate << 4) | (shortgi_rate); | 2041 | (shortgi_rate << 4) | (shortgi_rate); |
2059 | } | 2042 | } |
2060 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); | 2043 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
2061 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", | ||
2062 | rtl_read_dword(rtlpriv, REG_ARFR0)); | ||
2063 | } | 2044 | } |
2064 | 2045 | ||
2065 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | 2046 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 156b52732f3d..5847d6d0881e 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -851,6 +851,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
851 | if (unlikely(!_urb)) { | 851 | if (unlikely(!_urb)) { |
852 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 852 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
853 | "Can't allocate urb. Drop skb!\n"); | 853 | "Can't allocate urb. Drop skb!\n"); |
854 | kfree_skb(skb); | ||
854 | return; | 855 | return; |
855 | } | 856 | } |
856 | _rtl_submit_tx_urb(hw, _urb); | 857 | _rtl_submit_tx_urb(hw, _urb); |
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index eef38cfd812e..ca33ae193935 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/mei_bus.h> | 25 | #include <linux/mei_cl_bus.h> |
26 | 26 | ||
27 | #include <linux/nfc.h> | 27 | #include <linux/nfc.h> |
28 | #include <net/nfc/hci.h> | 28 | #include <net/nfc/hci.h> |
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | #define MICROREAD_DRIVER_NAME "microread" | 33 | #define MICROREAD_DRIVER_NAME "microread" |
34 | 34 | ||
35 | #define MICROREAD_UUID UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50, 0x94, \ | ||
36 | 0xd4, 0x50, 0x26, 0x67, 0x23, 0x77, 0x5c) | ||
37 | |||
38 | struct mei_nfc_hdr { | 35 | struct mei_nfc_hdr { |
39 | u8 cmd; | 36 | u8 cmd; |
40 | u8 status; | 37 | u8 status; |
@@ -48,7 +45,7 @@ struct mei_nfc_hdr { | |||
48 | #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) | 45 | #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) |
49 | 46 | ||
50 | struct microread_mei_phy { | 47 | struct microread_mei_phy { |
51 | struct mei_device *mei_device; | 48 | struct mei_cl_device *device; |
52 | struct nfc_hci_dev *hdev; | 49 | struct nfc_hci_dev *hdev; |
53 | 50 | ||
54 | int powered; | 51 | int powered; |
@@ -105,14 +102,14 @@ static int microread_mei_write(void *phy_id, struct sk_buff *skb) | |||
105 | 102 | ||
106 | MEI_DUMP_SKB_OUT("mei frame sent", skb); | 103 | MEI_DUMP_SKB_OUT("mei frame sent", skb); |
107 | 104 | ||
108 | r = mei_send(phy->device, skb->data, skb->len); | 105 | r = mei_cl_send(phy->device, skb->data, skb->len); |
109 | if (r > 0) | 106 | if (r > 0) |
110 | r = 0; | 107 | r = 0; |
111 | 108 | ||
112 | return r; | 109 | return r; |
113 | } | 110 | } |
114 | 111 | ||
115 | static void microread_event_cb(struct mei_device *device, u32 events, | 112 | static void microread_event_cb(struct mei_cl_device *device, u32 events, |
116 | void *context) | 113 | void *context) |
117 | { | 114 | { |
118 | struct microread_mei_phy *phy = context; | 115 | struct microread_mei_phy *phy = context; |
@@ -120,7 +117,7 @@ static void microread_event_cb(struct mei_device *device, u32 events, | |||
120 | if (phy->hard_fault != 0) | 117 | if (phy->hard_fault != 0) |
121 | return; | 118 | return; |
122 | 119 | ||
123 | if (events & BIT(MEI_EVENT_RX)) { | 120 | if (events & BIT(MEI_CL_EVENT_RX)) { |
124 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
125 | int reply_size; | 122 | int reply_size; |
126 | 123 | ||
@@ -128,7 +125,7 @@ static void microread_event_cb(struct mei_device *device, u32 events, | |||
128 | if (!skb) | 125 | if (!skb) |
129 | return; | 126 | return; |
130 | 127 | ||
131 | reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ); | 128 | reply_size = mei_cl_recv(device, skb->data, MEI_NFC_MAX_READ); |
132 | if (reply_size < MEI_NFC_HEADER_SIZE) { | 129 | if (reply_size < MEI_NFC_HEADER_SIZE) { |
133 | kfree(skb); | 130 | kfree(skb); |
134 | return; | 131 | return; |
@@ -149,8 +146,8 @@ static struct nfc_phy_ops mei_phy_ops = { | |||
149 | .disable = microread_mei_disable, | 146 | .disable = microread_mei_disable, |
150 | }; | 147 | }; |
151 | 148 | ||
152 | static int microread_mei_probe(struct mei_device *device, | 149 | static int microread_mei_probe(struct mei_cl_device *device, |
153 | const struct mei_id *id) | 150 | const struct mei_cl_device_id *id) |
154 | { | 151 | { |
155 | struct microread_mei_phy *phy; | 152 | struct microread_mei_phy *phy; |
156 | int r; | 153 | int r; |
@@ -164,9 +161,9 @@ static int microread_mei_probe(struct mei_device *device, | |||
164 | } | 161 | } |
165 | 162 | ||
166 | phy->device = device; | 163 | phy->device = device; |
167 | mei_set_clientdata(device, phy); | 164 | mei_cl_set_drvdata(device, phy); |
168 | 165 | ||
169 | r = mei_register_event_cb(device, microread_event_cb, phy); | 166 | r = mei_cl_register_event_cb(device, microread_event_cb, phy); |
170 | if (r) { | 167 | if (r) { |
171 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); | 168 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); |
172 | goto err_out; | 169 | goto err_out; |
@@ -186,9 +183,9 @@ err_out: | |||
186 | return r; | 183 | return r; |
187 | } | 184 | } |
188 | 185 | ||
189 | static int microread_mei_remove(struct mei_device *device) | 186 | static int microread_mei_remove(struct mei_cl_device *device) |
190 | { | 187 | { |
191 | struct microread_mei_phy *phy = mei_get_clientdata(device); | 188 | struct microread_mei_phy *phy = mei_cl_get_drvdata(device); |
192 | 189 | ||
193 | pr_info("Removing microread\n"); | 190 | pr_info("Removing microread\n"); |
194 | 191 | ||
@@ -202,16 +199,15 @@ static int microread_mei_remove(struct mei_device *device) | |||
202 | return 0; | 199 | return 0; |
203 | } | 200 | } |
204 | 201 | ||
205 | static struct mei_id microread_mei_tbl[] = { | 202 | static struct mei_cl_device_id microread_mei_tbl[] = { |
206 | { MICROREAD_DRIVER_NAME, MICROREAD_UUID }, | 203 | { MICROREAD_DRIVER_NAME }, |
207 | 204 | ||
208 | /* required last entry */ | 205 | /* required last entry */ |
209 | { } | 206 | { } |
210 | }; | 207 | }; |
211 | |||
212 | MODULE_DEVICE_TABLE(mei, microread_mei_tbl); | 208 | MODULE_DEVICE_TABLE(mei, microread_mei_tbl); |
213 | 209 | ||
214 | static struct mei_driver microread_driver = { | 210 | static struct mei_cl_driver microread_driver = { |
215 | .id_table = microread_mei_tbl, | 211 | .id_table = microread_mei_tbl, |
216 | .name = MICROREAD_DRIVER_NAME, | 212 | .name = MICROREAD_DRIVER_NAME, |
217 | 213 | ||
@@ -225,7 +221,7 @@ static int microread_mei_init(void) | |||
225 | 221 | ||
226 | pr_debug(DRIVER_DESC ": %s\n", __func__); | 222 | pr_debug(DRIVER_DESC ": %s\n", __func__); |
227 | 223 | ||
228 | r = mei_driver_register(µread_driver); | 224 | r = mei_cl_driver_register(µread_driver); |
229 | if (r) { | 225 | if (r) { |
230 | pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); | 226 | pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); |
231 | return r; | 227 | return r; |
@@ -236,7 +232,7 @@ static int microread_mei_init(void) | |||
236 | 232 | ||
237 | static void microread_mei_exit(void) | 233 | static void microread_mei_exit(void) |
238 | { | 234 | { |
239 | mei_driver_unregister(µread_driver); | 235 | mei_cl_driver_unregister(µread_driver); |
240 | } | 236 | } |
241 | 237 | ||
242 | module_init(microread_mei_init); | 238 | module_init(microread_mei_init); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dee5dddaa292..5147c210df52 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -53,14 +53,15 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) | |||
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | 55 | ||
56 | if (!pci_dev->pm_cap || !pci_dev->pme_support | 56 | /* Clear PME Status if set. */ |
57 | || pci_check_pme_status(pci_dev)) { | 57 | if (pci_dev->pme_support) |
58 | if (pci_dev->pme_poll) | 58 | pci_check_pme_status(pci_dev); |
59 | pci_dev->pme_poll = false; | ||
60 | 59 | ||
61 | pci_wakeup_event(pci_dev); | 60 | if (pci_dev->pme_poll) |
62 | pm_runtime_resume(&pci_dev->dev); | 61 | pci_dev->pme_poll = false; |
63 | } | 62 | |
63 | pci_wakeup_event(pci_dev); | ||
64 | pm_runtime_resume(&pci_dev->dev); | ||
64 | 65 | ||
65 | if (pci_dev->subordinate) | 66 | if (pci_dev->subordinate) |
66 | pci_pme_wakeup_bus(pci_dev->subordinate); | 67 | pci_pme_wakeup_bus(pci_dev->subordinate); |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 1fa1e482a999..79277fb36c6b 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -390,9 +390,10 @@ static void pci_device_shutdown(struct device *dev) | |||
390 | 390 | ||
391 | /* | 391 | /* |
392 | * Turn off Bus Master bit on the device to tell it to not | 392 | * Turn off Bus Master bit on the device to tell it to not |
393 | * continue to do DMA | 393 | * continue to do DMA. Don't touch devices in D3cold or unknown states. |
394 | */ | 394 | */ |
395 | pci_clear_master(pci_dev); | 395 | if (pci_dev->current_state <= PCI_D3hot) |
396 | pci_clear_master(pci_dev); | ||
396 | } | 397 | } |
397 | 398 | ||
398 | #ifdef CONFIG_PM | 399 | #ifdef CONFIG_PM |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 08c243ab034e..ed4d09498337 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -185,14 +185,6 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = { | |||
185 | #endif /* !PM */ | 185 | #endif /* !PM */ |
186 | 186 | ||
187 | /* | 187 | /* |
188 | * PCIe port runtime suspend is broken for some chipsets, so use a | ||
189 | * black list to disable runtime PM for these chipsets. | ||
190 | */ | ||
191 | static const struct pci_device_id port_runtime_pm_black_list[] = { | ||
192 | { /* end: all zeroes */ } | ||
193 | }; | ||
194 | |||
195 | /* | ||
196 | * pcie_portdrv_probe - Probe PCI-Express port devices | 188 | * pcie_portdrv_probe - Probe PCI-Express port devices |
197 | * @dev: PCI-Express port device being probed | 189 | * @dev: PCI-Express port device being probed |
198 | * | 190 | * |
@@ -225,16 +217,11 @@ static int pcie_portdrv_probe(struct pci_dev *dev, | |||
225 | * it by default. | 217 | * it by default. |
226 | */ | 218 | */ |
227 | dev->d3cold_allowed = false; | 219 | dev->d3cold_allowed = false; |
228 | if (!pci_match_id(port_runtime_pm_black_list, dev)) | ||
229 | pm_runtime_put_noidle(&dev->dev); | ||
230 | |||
231 | return 0; | 220 | return 0; |
232 | } | 221 | } |
233 | 222 | ||
234 | static void pcie_portdrv_remove(struct pci_dev *dev) | 223 | static void pcie_portdrv_remove(struct pci_dev *dev) |
235 | { | 224 | { |
236 | if (!pci_match_id(port_runtime_pm_black_list, dev)) | ||
237 | pm_runtime_get_noresume(&dev->dev); | ||
238 | pcie_port_device_remove(dev); | 225 | pcie_port_device_remove(dev); |
239 | pci_disable_device(dev); | 226 | pci_disable_device(dev); |
240 | } | 227 | } |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index ab886b7ee327..c5d0a08a8747 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -118,17 +118,11 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
118 | void __iomem *rom; | 118 | void __iomem *rom; |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * Some devices may provide ROMs via a source other than the BAR | ||
122 | */ | ||
123 | if (pdev->rom && pdev->romlen) { | ||
124 | *size = pdev->romlen; | ||
125 | return phys_to_virt(pdev->rom); | ||
126 | /* | ||
127 | * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy | 121 | * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy |
128 | * memory map if the VGA enable bit of the Bridge Control register is | 122 | * memory map if the VGA enable bit of the Bridge Control register is |
129 | * set for embedded VGA. | 123 | * set for embedded VGA. |
130 | */ | 124 | */ |
131 | } else if (res->flags & IORESOURCE_ROM_SHADOW) { | 125 | if (res->flags & IORESOURCE_ROM_SHADOW) { |
132 | /* primary video rom always starts here */ | 126 | /* primary video rom always starts here */ |
133 | start = (loff_t)0xC0000; | 127 | start = (loff_t)0xC0000; |
134 | *size = 0x20000; /* cover C000:0 through E000:0 */ | 128 | *size = 0x20000; /* cover C000:0 through E000:0 */ |
@@ -187,8 +181,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) | |||
187 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) | 181 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) |
188 | return; | 182 | return; |
189 | 183 | ||
190 | if (!pdev->rom || !pdev->romlen) | 184 | iounmap(rom); |
191 | iounmap(rom); | ||
192 | 185 | ||
193 | /* Disable again before continuing, leave enabled if pci=rom */ | 186 | /* Disable again before continuing, leave enabled if pci=rom */ |
194 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) | 187 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) |
@@ -212,7 +205,24 @@ void pci_cleanup_rom(struct pci_dev *pdev) | |||
212 | } | 205 | } |
213 | } | 206 | } |
214 | 207 | ||
208 | /** | ||
209 | * pci_platform_rom - provides a pointer to any ROM image provided by the | ||
210 | * platform | ||
211 | * @pdev: pointer to pci device struct | ||
212 | * @size: pointer to receive size of pci window over ROM | ||
213 | */ | ||
214 | void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size) | ||
215 | { | ||
216 | if (pdev->rom && pdev->romlen) { | ||
217 | *size = pdev->romlen; | ||
218 | return phys_to_virt((phys_addr_t)pdev->rom); | ||
219 | } | ||
220 | |||
221 | return NULL; | ||
222 | } | ||
223 | |||
215 | EXPORT_SYMBOL(pci_map_rom); | 224 | EXPORT_SYMBOL(pci_map_rom); |
216 | EXPORT_SYMBOL(pci_unmap_rom); | 225 | EXPORT_SYMBOL(pci_unmap_rom); |
217 | EXPORT_SYMBOL_GPL(pci_enable_rom); | 226 | EXPORT_SYMBOL_GPL(pci_enable_rom); |
218 | EXPORT_SYMBOL_GPL(pci_disable_rom); | 227 | EXPORT_SYMBOL_GPL(pci_disable_rom); |
228 | EXPORT_SYMBOL(pci_platform_rom); | ||
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index c689c04a4f52..2d2f0a43d36b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c | |||
@@ -620,7 +620,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) | |||
620 | 620 | ||
621 | /* special soc specific control */ | 621 | /* special soc specific control */ |
622 | if (ctrl->mpp_get || ctrl->mpp_set) { | 622 | if (ctrl->mpp_get || ctrl->mpp_set) { |
623 | if (!ctrl->name || !ctrl->mpp_set || !ctrl->mpp_set) { | 623 | if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) { |
624 | dev_err(&pdev->dev, "wrong soc control info\n"); | 624 | dev_err(&pdev->dev, "wrong soc control info\n"); |
625 | return -EINVAL; | 625 | return -EINVAL; |
626 | } | 626 | } |
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index ac8d382a79bb..d611ecfcbf70 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -622,7 +622,7 @@ static const struct file_operations pinconf_dbg_pinname_fops = { | |||
622 | static int pinconf_dbg_state_print(struct seq_file *s, void *d) | 622 | static int pinconf_dbg_state_print(struct seq_file *s, void *d) |
623 | { | 623 | { |
624 | if (strlen(dbg_state_name)) | 624 | if (strlen(dbg_state_name)) |
625 | seq_printf(s, "%s\n", dbg_pinname); | 625 | seq_printf(s, "%s\n", dbg_state_name); |
626 | else | 626 | else |
627 | seq_printf(s, "No pin state set\n"); | 627 | seq_printf(s, "No pin state set\n"); |
628 | return 0; | 628 | return 0; |
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h index e3ed8cb072a5..bfda73d64eed 100644 --- a/drivers/pinctrl/pinconf.h +++ b/drivers/pinctrl/pinconf.h | |||
@@ -90,7 +90,7 @@ static inline void pinconf_init_device_debugfs(struct dentry *devroot, | |||
90 | * pin config. | 90 | * pin config. |
91 | */ | 91 | */ |
92 | 92 | ||
93 | #ifdef CONFIG_GENERIC_PINCONF | 93 | #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS) |
94 | 94 | ||
95 | void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, | 95 | void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, |
96 | struct seq_file *s, unsigned pin); | 96 | struct seq_file *s, unsigned pin); |
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index caecdd373061..c542a97c82f3 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
@@ -422,7 +422,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* check if pin use AlternateFunction register */ | 424 | /* check if pin use AlternateFunction register */ |
425 | if ((af.alt_bit1 == UNUSED) && (af.alt_bit1 == UNUSED)) | 425 | if ((af.alt_bit1 == UNUSED) && (af.alt_bit2 == UNUSED)) |
426 | return mode; | 426 | return mode; |
427 | /* | 427 | /* |
428 | * if pin GPIOSEL bit is set and pin supports alternate function, | 428 | * if pin GPIOSEL bit is set and pin supports alternate function, |
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 75933a6aa828..efb7f10e902a 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -1277,21 +1277,80 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type) | |||
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | #ifdef CONFIG_PM | 1279 | #ifdef CONFIG_PM |
1280 | |||
1281 | static u32 wakeups[MAX_GPIO_BANKS]; | ||
1282 | static u32 backups[MAX_GPIO_BANKS]; | ||
1283 | |||
1280 | static int gpio_irq_set_wake(struct irq_data *d, unsigned state) | 1284 | static int gpio_irq_set_wake(struct irq_data *d, unsigned state) |
1281 | { | 1285 | { |
1282 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); | 1286 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); |
1283 | unsigned bank = at91_gpio->pioc_idx; | 1287 | unsigned bank = at91_gpio->pioc_idx; |
1288 | unsigned mask = 1 << d->hwirq; | ||
1284 | 1289 | ||
1285 | if (unlikely(bank >= MAX_GPIO_BANKS)) | 1290 | if (unlikely(bank >= MAX_GPIO_BANKS)) |
1286 | return -EINVAL; | 1291 | return -EINVAL; |
1287 | 1292 | ||
1293 | if (state) | ||
1294 | wakeups[bank] |= mask; | ||
1295 | else | ||
1296 | wakeups[bank] &= ~mask; | ||
1297 | |||
1288 | irq_set_irq_wake(at91_gpio->pioc_virq, state); | 1298 | irq_set_irq_wake(at91_gpio->pioc_virq, state); |
1289 | 1299 | ||
1290 | return 0; | 1300 | return 0; |
1291 | } | 1301 | } |
1302 | |||
1303 | void at91_pinctrl_gpio_suspend(void) | ||
1304 | { | ||
1305 | int i; | ||
1306 | |||
1307 | for (i = 0; i < gpio_banks; i++) { | ||
1308 | void __iomem *pio; | ||
1309 | |||
1310 | if (!gpio_chips[i]) | ||
1311 | continue; | ||
1312 | |||
1313 | pio = gpio_chips[i]->regbase; | ||
1314 | |||
1315 | backups[i] = __raw_readl(pio + PIO_IMR); | ||
1316 | __raw_writel(backups[i], pio + PIO_IDR); | ||
1317 | __raw_writel(wakeups[i], pio + PIO_IER); | ||
1318 | |||
1319 | if (!wakeups[i]) { | ||
1320 | clk_unprepare(gpio_chips[i]->clock); | ||
1321 | clk_disable(gpio_chips[i]->clock); | ||
1322 | } else { | ||
1323 | printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", | ||
1324 | 'A'+i, wakeups[i]); | ||
1325 | } | ||
1326 | } | ||
1327 | } | ||
1328 | |||
1329 | void at91_pinctrl_gpio_resume(void) | ||
1330 | { | ||
1331 | int i; | ||
1332 | |||
1333 | for (i = 0; i < gpio_banks; i++) { | ||
1334 | void __iomem *pio; | ||
1335 | |||
1336 | if (!gpio_chips[i]) | ||
1337 | continue; | ||
1338 | |||
1339 | pio = gpio_chips[i]->regbase; | ||
1340 | |||
1341 | if (!wakeups[i]) { | ||
1342 | if (clk_prepare(gpio_chips[i]->clock) == 0) | ||
1343 | clk_enable(gpio_chips[i]->clock); | ||
1344 | } | ||
1345 | |||
1346 | __raw_writel(wakeups[i], pio + PIO_IDR); | ||
1347 | __raw_writel(backups[i], pio + PIO_IER); | ||
1348 | } | ||
1349 | } | ||
1350 | |||
1292 | #else | 1351 | #else |
1293 | #define gpio_irq_set_wake NULL | 1352 | #define gpio_irq_set_wake NULL |
1294 | #endif | 1353 | #endif /* CONFIG_PM */ |
1295 | 1354 | ||
1296 | static struct irq_chip gpio_irqchip = { | 1355 | static struct irq_chip gpio_irqchip = { |
1297 | .name = "GPIO", | 1356 | .name = "GPIO", |
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 1a00658b3ea0..bd83c8b01cd1 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c | |||
@@ -194,6 +194,11 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin, | |||
194 | } | 194 | } |
195 | 195 | ||
196 | if (!gpio_range) { | 196 | if (!gpio_range) { |
197 | /* | ||
198 | * A pin should not be freed more times than allocated. | ||
199 | */ | ||
200 | if (WARN_ON(!desc->mux_usecount)) | ||
201 | return NULL; | ||
197 | desc->mux_usecount--; | 202 | desc->mux_usecount--; |
198 | if (desc->mux_usecount) | 203 | if (desc->mux_usecount) |
199 | return NULL; | 204 | return NULL; |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 45cacf79f3a7..1a779bbfb87d 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -134,7 +134,6 @@ static const struct key_entry hp_wmi_keymap[] = { | |||
134 | { KE_KEY, 0x2142, { KEY_MEDIA } }, | 134 | { KE_KEY, 0x2142, { KEY_MEDIA } }, |
135 | { KE_KEY, 0x213b, { KEY_INFO } }, | 135 | { KE_KEY, 0x213b, { KEY_INFO } }, |
136 | { KE_KEY, 0x2169, { KEY_DIRECTION } }, | 136 | { KE_KEY, 0x2169, { KEY_DIRECTION } }, |
137 | { KE_KEY, 0x216a, { KEY_SETUP } }, | ||
138 | { KE_KEY, 0x231b, { KEY_HELP } }, | 137 | { KE_KEY, 0x231b, { KEY_HELP } }, |
139 | { KE_END, 0 } | 138 | { KE_END, 0 } |
140 | }; | 139 | }; |
@@ -925,9 +924,6 @@ static int __init hp_wmi_init(void) | |||
925 | err = hp_wmi_input_setup(); | 924 | err = hp_wmi_input_setup(); |
926 | if (err) | 925 | if (err) |
927 | return err; | 926 | return err; |
928 | |||
929 | //Enable magic for hotkeys that run on the SMBus | ||
930 | ec_write(0xe6,0x6e); | ||
931 | } | 927 | } |
932 | 928 | ||
933 | if (bios_capable) { | 929 | if (bios_capable) { |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 9a907567f41e..edec135b1685 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -1964,9 +1964,6 @@ struct tp_nvram_state { | |||
1964 | /* kthread for the hotkey poller */ | 1964 | /* kthread for the hotkey poller */ |
1965 | static struct task_struct *tpacpi_hotkey_task; | 1965 | static struct task_struct *tpacpi_hotkey_task; |
1966 | 1966 | ||
1967 | /* Acquired while the poller kthread is running, use to sync start/stop */ | ||
1968 | static struct mutex hotkey_thread_mutex; | ||
1969 | |||
1970 | /* | 1967 | /* |
1971 | * Acquire mutex to write poller control variables as an | 1968 | * Acquire mutex to write poller control variables as an |
1972 | * atomic block. | 1969 | * atomic block. |
@@ -2462,8 +2459,6 @@ static int hotkey_kthread(void *data) | |||
2462 | unsigned int poll_freq; | 2459 | unsigned int poll_freq; |
2463 | bool was_frozen; | 2460 | bool was_frozen; |
2464 | 2461 | ||
2465 | mutex_lock(&hotkey_thread_mutex); | ||
2466 | |||
2467 | if (tpacpi_lifecycle == TPACPI_LIFE_EXITING) | 2462 | if (tpacpi_lifecycle == TPACPI_LIFE_EXITING) |
2468 | goto exit; | 2463 | goto exit; |
2469 | 2464 | ||
@@ -2523,7 +2518,6 @@ static int hotkey_kthread(void *data) | |||
2523 | } | 2518 | } |
2524 | 2519 | ||
2525 | exit: | 2520 | exit: |
2526 | mutex_unlock(&hotkey_thread_mutex); | ||
2527 | return 0; | 2521 | return 0; |
2528 | } | 2522 | } |
2529 | 2523 | ||
@@ -2533,9 +2527,6 @@ static void hotkey_poll_stop_sync(void) | |||
2533 | if (tpacpi_hotkey_task) { | 2527 | if (tpacpi_hotkey_task) { |
2534 | kthread_stop(tpacpi_hotkey_task); | 2528 | kthread_stop(tpacpi_hotkey_task); |
2535 | tpacpi_hotkey_task = NULL; | 2529 | tpacpi_hotkey_task = NULL; |
2536 | mutex_lock(&hotkey_thread_mutex); | ||
2537 | /* at this point, the thread did exit */ | ||
2538 | mutex_unlock(&hotkey_thread_mutex); | ||
2539 | } | 2530 | } |
2540 | } | 2531 | } |
2541 | 2532 | ||
@@ -3234,7 +3225,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3234 | mutex_init(&hotkey_mutex); | 3225 | mutex_init(&hotkey_mutex); |
3235 | 3226 | ||
3236 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL | 3227 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL |
3237 | mutex_init(&hotkey_thread_mutex); | ||
3238 | mutex_init(&hotkey_thread_data_mutex); | 3228 | mutex_init(&hotkey_thread_data_mutex); |
3239 | #endif | 3229 | #endif |
3240 | 3230 | ||
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index cc1f7bf53fd0..c6d77e20622c 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig | |||
@@ -4,7 +4,7 @@ menu "Remoteproc drivers" | |||
4 | config REMOTEPROC | 4 | config REMOTEPROC |
5 | tristate | 5 | tristate |
6 | depends on HAS_DMA | 6 | depends on HAS_DMA |
7 | select FW_CONFIG | 7 | select FW_LOADER |
8 | select VIRTIO | 8 | select VIRTIO |
9 | 9 | ||
10 | config OMAP_REMOTEPROC | 10 | config OMAP_REMOTEPROC |
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 29387df4bfc9..8edb4aed5d36 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
@@ -217,7 +217,7 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) | |||
217 | * TODO: support predefined notifyids (via resource table) | 217 | * TODO: support predefined notifyids (via resource table) |
218 | */ | 218 | */ |
219 | ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL); | 219 | ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL); |
220 | if (ret) { | 220 | if (ret < 0) { |
221 | dev_err(dev, "idr_alloc failed: %d\n", ret); | 221 | dev_err(dev, "idr_alloc failed: %d\n", ret); |
222 | dma_free_coherent(dev->parent, size, va, dma); | 222 | dma_free_coherent(dev->parent, size, va, dma); |
223 | return ret; | 223 | return ret; |
@@ -366,10 +366,12 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, | |||
366 | /* it is now safe to add the virtio device */ | 366 | /* it is now safe to add the virtio device */ |
367 | ret = rproc_add_virtio_dev(rvdev, rsc->id); | 367 | ret = rproc_add_virtio_dev(rvdev, rsc->id); |
368 | if (ret) | 368 | if (ret) |
369 | goto free_rvdev; | 369 | goto remove_rvdev; |
370 | 370 | ||
371 | return 0; | 371 | return 0; |
372 | 372 | ||
373 | remove_rvdev: | ||
374 | list_del(&rvdev->node); | ||
373 | free_rvdev: | 375 | free_rvdev: |
374 | kfree(rvdev); | 376 | kfree(rvdev); |
375 | return ret; | 377 | return ret; |
diff --git a/drivers/remoteproc/ste_modem_rproc.c b/drivers/remoteproc/ste_modem_rproc.c index a7743c069339..fb95c4220052 100644 --- a/drivers/remoteproc/ste_modem_rproc.c +++ b/drivers/remoteproc/ste_modem_rproc.c | |||
@@ -240,6 +240,8 @@ static int sproc_drv_remove(struct platform_device *pdev) | |||
240 | 240 | ||
241 | /* Unregister as remoteproc device */ | 241 | /* Unregister as remoteproc device */ |
242 | rproc_del(sproc->rproc); | 242 | rproc_del(sproc->rproc); |
243 | dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE, | ||
244 | sproc->fw_addr, sproc->fw_dma_addr); | ||
243 | rproc_put(sproc->rproc); | 245 | rproc_put(sproc->rproc); |
244 | 246 | ||
245 | mdev->drv_data = NULL; | 247 | mdev->drv_data = NULL; |
@@ -297,10 +299,13 @@ static int sproc_probe(struct platform_device *pdev) | |||
297 | /* Register as a remoteproc device */ | 299 | /* Register as a remoteproc device */ |
298 | err = rproc_add(rproc); | 300 | err = rproc_add(rproc); |
299 | if (err) | 301 | if (err) |
300 | goto free_rproc; | 302 | goto free_mem; |
301 | 303 | ||
302 | return 0; | 304 | return 0; |
303 | 305 | ||
306 | free_mem: | ||
307 | dma_free_coherent(rproc->dev.parent, SPROC_FW_SIZE, | ||
308 | sproc->fw_addr, sproc->fw_dma_addr); | ||
304 | free_rproc: | 309 | free_rproc: |
305 | /* Reset device data upon error */ | 310 | /* Reset device data upon error */ |
306 | mdev->drv_data = NULL; | 311 | mdev->drv_data = NULL; |
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c index 0dde688ca09b..969abbad7fe3 100644 --- a/drivers/rtc/rtc-da9052.c +++ b/drivers/rtc/rtc-da9052.c | |||
@@ -239,11 +239,9 @@ static int da9052_rtc_probe(struct platform_device *pdev) | |||
239 | 239 | ||
240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); | 240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); |
241 | platform_set_drvdata(pdev, rtc); | 241 | platform_set_drvdata(pdev, rtc); |
242 | rtc->irq = platform_get_irq_byname(pdev, "ALM"); | 242 | rtc->irq = DA9052_IRQ_ALARM; |
243 | ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, | 243 | ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM", |
244 | da9052_rtc_irq, | 244 | da9052_rtc_irq, rtc); |
245 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
246 | "ALM", rtc); | ||
247 | if (ret != 0) { | 245 | if (ret != 0) { |
248 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); | 246 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); |
249 | return ret; | 247 | return ret; |
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index 57233c885998..8f87fec27ce7 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/clk.h> | ||
17 | #include <linux/gfp.h> | 18 | #include <linux/gfp.h> |
18 | #include <linux/module.h> | 19 | #include <linux/module.h> |
19 | 20 | ||
@@ -41,6 +42,7 @@ struct rtc_plat_data { | |||
41 | struct rtc_device *rtc; | 42 | struct rtc_device *rtc; |
42 | void __iomem *ioaddr; | 43 | void __iomem *ioaddr; |
43 | int irq; | 44 | int irq; |
45 | struct clk *clk; | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) | 48 | static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) |
@@ -221,6 +223,7 @@ static int mv_rtc_probe(struct platform_device *pdev) | |||
221 | struct rtc_plat_data *pdata; | 223 | struct rtc_plat_data *pdata; |
222 | resource_size_t size; | 224 | resource_size_t size; |
223 | u32 rtc_time; | 225 | u32 rtc_time; |
226 | int ret = 0; | ||
224 | 227 | ||
225 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 228 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
226 | if (!res) | 229 | if (!res) |
@@ -239,11 +242,17 @@ static int mv_rtc_probe(struct platform_device *pdev) | |||
239 | if (!pdata->ioaddr) | 242 | if (!pdata->ioaddr) |
240 | return -ENOMEM; | 243 | return -ENOMEM; |
241 | 244 | ||
245 | pdata->clk = devm_clk_get(&pdev->dev, NULL); | ||
246 | /* Not all SoCs require a clock.*/ | ||
247 | if (!IS_ERR(pdata->clk)) | ||
248 | clk_prepare_enable(pdata->clk); | ||
249 | |||
242 | /* make sure the 24 hours mode is enabled */ | 250 | /* make sure the 24 hours mode is enabled */ |
243 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); | 251 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); |
244 | if (rtc_time & RTC_HOURS_12H_MODE) { | 252 | if (rtc_time & RTC_HOURS_12H_MODE) { |
245 | dev_err(&pdev->dev, "24 Hours mode not supported.\n"); | 253 | dev_err(&pdev->dev, "24 Hours mode not supported.\n"); |
246 | return -EINVAL; | 254 | ret = -EINVAL; |
255 | goto out; | ||
247 | } | 256 | } |
248 | 257 | ||
249 | /* make sure it is actually functional */ | 258 | /* make sure it is actually functional */ |
@@ -252,7 +261,8 @@ static int mv_rtc_probe(struct platform_device *pdev) | |||
252 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); | 261 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); |
253 | if (rtc_time == 0x01000000) { | 262 | if (rtc_time == 0x01000000) { |
254 | dev_err(&pdev->dev, "internal RTC not ticking\n"); | 263 | dev_err(&pdev->dev, "internal RTC not ticking\n"); |
255 | return -ENODEV; | 264 | ret = -ENODEV; |
265 | goto out; | ||
256 | } | 266 | } |
257 | } | 267 | } |
258 | 268 | ||
@@ -268,8 +278,10 @@ static int mv_rtc_probe(struct platform_device *pdev) | |||
268 | } else | 278 | } else |
269 | pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, | 279 | pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, |
270 | &mv_rtc_ops, THIS_MODULE); | 280 | &mv_rtc_ops, THIS_MODULE); |
271 | if (IS_ERR(pdata->rtc)) | 281 | if (IS_ERR(pdata->rtc)) { |
272 | return PTR_ERR(pdata->rtc); | 282 | ret = PTR_ERR(pdata->rtc); |
283 | goto out; | ||
284 | } | ||
273 | 285 | ||
274 | if (pdata->irq >= 0) { | 286 | if (pdata->irq >= 0) { |
275 | writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); | 287 | writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
@@ -282,6 +294,11 @@ static int mv_rtc_probe(struct platform_device *pdev) | |||
282 | } | 294 | } |
283 | 295 | ||
284 | return 0; | 296 | return 0; |
297 | out: | ||
298 | if (!IS_ERR(pdata->clk)) | ||
299 | clk_disable_unprepare(pdata->clk); | ||
300 | |||
301 | return ret; | ||
285 | } | 302 | } |
286 | 303 | ||
287 | static int __exit mv_rtc_remove(struct platform_device *pdev) | 304 | static int __exit mv_rtc_remove(struct platform_device *pdev) |
@@ -292,6 +309,9 @@ static int __exit mv_rtc_remove(struct platform_device *pdev) | |||
292 | device_init_wakeup(&pdev->dev, 0); | 309 | device_init_wakeup(&pdev->dev, 0); |
293 | 310 | ||
294 | rtc_device_unregister(pdata->rtc); | 311 | rtc_device_unregister(pdata->rtc); |
312 | if (!IS_ERR(pdata->clk)) | ||
313 | clk_disable_unprepare(pdata->clk); | ||
314 | |||
295 | return 0; | 315 | return 0; |
296 | } | 316 | } |
297 | 317 | ||
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c index 9978ad4433cb..e9b9c8392832 100644 --- a/drivers/s390/block/scm_blk.c +++ b/drivers/s390/block/scm_blk.c | |||
@@ -135,6 +135,11 @@ static const struct block_device_operations scm_blk_devops = { | |||
135 | .release = scm_release, | 135 | .release = scm_release, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static bool scm_permit_request(struct scm_blk_dev *bdev, struct request *req) | ||
139 | { | ||
140 | return rq_data_dir(req) != WRITE || bdev->state != SCM_WR_PROHIBIT; | ||
141 | } | ||
142 | |||
138 | static void scm_request_prepare(struct scm_request *scmrq) | 143 | static void scm_request_prepare(struct scm_request *scmrq) |
139 | { | 144 | { |
140 | struct scm_blk_dev *bdev = scmrq->bdev; | 145 | struct scm_blk_dev *bdev = scmrq->bdev; |
@@ -195,14 +200,18 @@ void scm_request_requeue(struct scm_request *scmrq) | |||
195 | 200 | ||
196 | scm_release_cluster(scmrq); | 201 | scm_release_cluster(scmrq); |
197 | blk_requeue_request(bdev->rq, scmrq->request); | 202 | blk_requeue_request(bdev->rq, scmrq->request); |
203 | atomic_dec(&bdev->queued_reqs); | ||
198 | scm_request_done(scmrq); | 204 | scm_request_done(scmrq); |
199 | scm_ensure_queue_restart(bdev); | 205 | scm_ensure_queue_restart(bdev); |
200 | } | 206 | } |
201 | 207 | ||
202 | void scm_request_finish(struct scm_request *scmrq) | 208 | void scm_request_finish(struct scm_request *scmrq) |
203 | { | 209 | { |
210 | struct scm_blk_dev *bdev = scmrq->bdev; | ||
211 | |||
204 | scm_release_cluster(scmrq); | 212 | scm_release_cluster(scmrq); |
205 | blk_end_request_all(scmrq->request, scmrq->error); | 213 | blk_end_request_all(scmrq->request, scmrq->error); |
214 | atomic_dec(&bdev->queued_reqs); | ||
206 | scm_request_done(scmrq); | 215 | scm_request_done(scmrq); |
207 | } | 216 | } |
208 | 217 | ||
@@ -218,6 +227,10 @@ static void scm_blk_request(struct request_queue *rq) | |||
218 | if (req->cmd_type != REQ_TYPE_FS) | 227 | if (req->cmd_type != REQ_TYPE_FS) |
219 | continue; | 228 | continue; |
220 | 229 | ||
230 | if (!scm_permit_request(bdev, req)) { | ||
231 | scm_ensure_queue_restart(bdev); | ||
232 | return; | ||
233 | } | ||
221 | scmrq = scm_request_fetch(); | 234 | scmrq = scm_request_fetch(); |
222 | if (!scmrq) { | 235 | if (!scmrq) { |
223 | SCM_LOG(5, "no request"); | 236 | SCM_LOG(5, "no request"); |
@@ -231,11 +244,13 @@ static void scm_blk_request(struct request_queue *rq) | |||
231 | return; | 244 | return; |
232 | } | 245 | } |
233 | if (scm_need_cluster_request(scmrq)) { | 246 | if (scm_need_cluster_request(scmrq)) { |
247 | atomic_inc(&bdev->queued_reqs); | ||
234 | blk_start_request(req); | 248 | blk_start_request(req); |
235 | scm_initiate_cluster_request(scmrq); | 249 | scm_initiate_cluster_request(scmrq); |
236 | return; | 250 | return; |
237 | } | 251 | } |
238 | scm_request_prepare(scmrq); | 252 | scm_request_prepare(scmrq); |
253 | atomic_inc(&bdev->queued_reqs); | ||
239 | blk_start_request(req); | 254 | blk_start_request(req); |
240 | 255 | ||
241 | ret = scm_start_aob(scmrq->aob); | 256 | ret = scm_start_aob(scmrq->aob); |
@@ -244,7 +259,6 @@ static void scm_blk_request(struct request_queue *rq) | |||
244 | scm_request_requeue(scmrq); | 259 | scm_request_requeue(scmrq); |
245 | return; | 260 | return; |
246 | } | 261 | } |
247 | atomic_inc(&bdev->queued_reqs); | ||
248 | } | 262 | } |
249 | } | 263 | } |
250 | 264 | ||
@@ -280,6 +294,38 @@ void scm_blk_irq(struct scm_device *scmdev, void *data, int error) | |||
280 | tasklet_hi_schedule(&bdev->tasklet); | 294 | tasklet_hi_schedule(&bdev->tasklet); |
281 | } | 295 | } |
282 | 296 | ||
297 | static void scm_blk_handle_error(struct scm_request *scmrq) | ||
298 | { | ||
299 | struct scm_blk_dev *bdev = scmrq->bdev; | ||
300 | unsigned long flags; | ||
301 | |||
302 | if (scmrq->error != -EIO) | ||
303 | goto restart; | ||
304 | |||
305 | /* For -EIO the response block is valid. */ | ||
306 | switch (scmrq->aob->response.eqc) { | ||
307 | case EQC_WR_PROHIBIT: | ||
308 | spin_lock_irqsave(&bdev->lock, flags); | ||
309 | if (bdev->state != SCM_WR_PROHIBIT) | ||
310 | pr_info("%lx: Write access to the SCM increment is suspended\n", | ||
311 | (unsigned long) bdev->scmdev->address); | ||
312 | bdev->state = SCM_WR_PROHIBIT; | ||
313 | spin_unlock_irqrestore(&bdev->lock, flags); | ||
314 | goto requeue; | ||
315 | default: | ||
316 | break; | ||
317 | } | ||
318 | |||
319 | restart: | ||
320 | if (!scm_start_aob(scmrq->aob)) | ||
321 | return; | ||
322 | |||
323 | requeue: | ||
324 | spin_lock_irqsave(&bdev->rq_lock, flags); | ||
325 | scm_request_requeue(scmrq); | ||
326 | spin_unlock_irqrestore(&bdev->rq_lock, flags); | ||
327 | } | ||
328 | |||
283 | static void scm_blk_tasklet(struct scm_blk_dev *bdev) | 329 | static void scm_blk_tasklet(struct scm_blk_dev *bdev) |
284 | { | 330 | { |
285 | struct scm_request *scmrq; | 331 | struct scm_request *scmrq; |
@@ -293,11 +339,8 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev) | |||
293 | spin_unlock_irqrestore(&bdev->lock, flags); | 339 | spin_unlock_irqrestore(&bdev->lock, flags); |
294 | 340 | ||
295 | if (scmrq->error && scmrq->retries-- > 0) { | 341 | if (scmrq->error && scmrq->retries-- > 0) { |
296 | if (scm_start_aob(scmrq->aob)) { | 342 | scm_blk_handle_error(scmrq); |
297 | spin_lock_irqsave(&bdev->rq_lock, flags); | 343 | |
298 | scm_request_requeue(scmrq); | ||
299 | spin_unlock_irqrestore(&bdev->rq_lock, flags); | ||
300 | } | ||
301 | /* Request restarted or requeued, handle next. */ | 344 | /* Request restarted or requeued, handle next. */ |
302 | spin_lock_irqsave(&bdev->lock, flags); | 345 | spin_lock_irqsave(&bdev->lock, flags); |
303 | continue; | 346 | continue; |
@@ -310,7 +353,6 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev) | |||
310 | } | 353 | } |
311 | 354 | ||
312 | scm_request_finish(scmrq); | 355 | scm_request_finish(scmrq); |
313 | atomic_dec(&bdev->queued_reqs); | ||
314 | spin_lock_irqsave(&bdev->lock, flags); | 356 | spin_lock_irqsave(&bdev->lock, flags); |
315 | } | 357 | } |
316 | spin_unlock_irqrestore(&bdev->lock, flags); | 358 | spin_unlock_irqrestore(&bdev->lock, flags); |
@@ -332,6 +374,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev) | |||
332 | } | 374 | } |
333 | 375 | ||
334 | bdev->scmdev = scmdev; | 376 | bdev->scmdev = scmdev; |
377 | bdev->state = SCM_OPER; | ||
335 | spin_lock_init(&bdev->rq_lock); | 378 | spin_lock_init(&bdev->rq_lock); |
336 | spin_lock_init(&bdev->lock); | 379 | spin_lock_init(&bdev->lock); |
337 | INIT_LIST_HEAD(&bdev->finished_requests); | 380 | INIT_LIST_HEAD(&bdev->finished_requests); |
@@ -396,6 +439,18 @@ void scm_blk_dev_cleanup(struct scm_blk_dev *bdev) | |||
396 | put_disk(bdev->gendisk); | 439 | put_disk(bdev->gendisk); |
397 | } | 440 | } |
398 | 441 | ||
442 | void scm_blk_set_available(struct scm_blk_dev *bdev) | ||
443 | { | ||
444 | unsigned long flags; | ||
445 | |||
446 | spin_lock_irqsave(&bdev->lock, flags); | ||
447 | if (bdev->state == SCM_WR_PROHIBIT) | ||
448 | pr_info("%lx: Write access to the SCM increment is restored\n", | ||
449 | (unsigned long) bdev->scmdev->address); | ||
450 | bdev->state = SCM_OPER; | ||
451 | spin_unlock_irqrestore(&bdev->lock, flags); | ||
452 | } | ||
453 | |||
399 | static int __init scm_blk_init(void) | 454 | static int __init scm_blk_init(void) |
400 | { | 455 | { |
401 | int ret = -EINVAL; | 456 | int ret = -EINVAL; |
@@ -408,12 +463,15 @@ static int __init scm_blk_init(void) | |||
408 | goto out; | 463 | goto out; |
409 | 464 | ||
410 | scm_major = ret; | 465 | scm_major = ret; |
411 | if (scm_alloc_rqs(nr_requests)) | 466 | ret = scm_alloc_rqs(nr_requests); |
467 | if (ret) | ||
412 | goto out_unreg; | 468 | goto out_unreg; |
413 | 469 | ||
414 | scm_debug = debug_register("scm_log", 16, 1, 16); | 470 | scm_debug = debug_register("scm_log", 16, 1, 16); |
415 | if (!scm_debug) | 471 | if (!scm_debug) { |
472 | ret = -ENOMEM; | ||
416 | goto out_free; | 473 | goto out_free; |
474 | } | ||
417 | 475 | ||
418 | debug_register_view(scm_debug, &debug_hex_ascii_view); | 476 | debug_register_view(scm_debug, &debug_hex_ascii_view); |
419 | debug_set_level(scm_debug, 2); | 477 | debug_set_level(scm_debug, 2); |
diff --git a/drivers/s390/block/scm_blk.h b/drivers/s390/block/scm_blk.h index 3c1ccf494647..8b387b32fd62 100644 --- a/drivers/s390/block/scm_blk.h +++ b/drivers/s390/block/scm_blk.h | |||
@@ -21,6 +21,7 @@ struct scm_blk_dev { | |||
21 | spinlock_t rq_lock; /* guard the request queue */ | 21 | spinlock_t rq_lock; /* guard the request queue */ |
22 | spinlock_t lock; /* guard the rest of the blockdev */ | 22 | spinlock_t lock; /* guard the rest of the blockdev */ |
23 | atomic_t queued_reqs; | 23 | atomic_t queued_reqs; |
24 | enum {SCM_OPER, SCM_WR_PROHIBIT} state; | ||
24 | struct list_head finished_requests; | 25 | struct list_head finished_requests; |
25 | #ifdef CONFIG_SCM_BLOCK_CLUSTER_WRITE | 26 | #ifdef CONFIG_SCM_BLOCK_CLUSTER_WRITE |
26 | struct list_head cluster_list; | 27 | struct list_head cluster_list; |
@@ -48,6 +49,7 @@ struct scm_request { | |||
48 | 49 | ||
49 | int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *); | 50 | int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *); |
50 | void scm_blk_dev_cleanup(struct scm_blk_dev *); | 51 | void scm_blk_dev_cleanup(struct scm_blk_dev *); |
52 | void scm_blk_set_available(struct scm_blk_dev *); | ||
51 | void scm_blk_irq(struct scm_device *, void *, int); | 53 | void scm_blk_irq(struct scm_device *, void *, int); |
52 | 54 | ||
53 | void scm_request_finish(struct scm_request *); | 55 | void scm_request_finish(struct scm_request *); |
diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c index 9fa0a908607b..c98cf52d78d1 100644 --- a/drivers/s390/block/scm_drv.c +++ b/drivers/s390/block/scm_drv.c | |||
@@ -13,12 +13,23 @@ | |||
13 | #include <asm/eadm.h> | 13 | #include <asm/eadm.h> |
14 | #include "scm_blk.h" | 14 | #include "scm_blk.h" |
15 | 15 | ||
16 | static void notify(struct scm_device *scmdev) | 16 | static void scm_notify(struct scm_device *scmdev, enum scm_event event) |
17 | { | 17 | { |
18 | pr_info("%lu: The capabilities of the SCM increment changed\n", | 18 | struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); |
19 | (unsigned long) scmdev->address); | 19 | |
20 | SCM_LOG(2, "State changed"); | 20 | switch (event) { |
21 | SCM_LOG_STATE(2, scmdev); | 21 | case SCM_CHANGE: |
22 | pr_info("%lx: The capabilities of the SCM increment changed\n", | ||
23 | (unsigned long) scmdev->address); | ||
24 | SCM_LOG(2, "State changed"); | ||
25 | SCM_LOG_STATE(2, scmdev); | ||
26 | break; | ||
27 | case SCM_AVAIL: | ||
28 | SCM_LOG(2, "Increment available"); | ||
29 | SCM_LOG_STATE(2, scmdev); | ||
30 | scm_blk_set_available(bdev); | ||
31 | break; | ||
32 | } | ||
22 | } | 33 | } |
23 | 34 | ||
24 | static int scm_probe(struct scm_device *scmdev) | 35 | static int scm_probe(struct scm_device *scmdev) |
@@ -64,7 +75,7 @@ static struct scm_driver scm_drv = { | |||
64 | .name = "scm_block", | 75 | .name = "scm_block", |
65 | .owner = THIS_MODULE, | 76 | .owner = THIS_MODULE, |
66 | }, | 77 | }, |
67 | .notify = notify, | 78 | .notify = scm_notify, |
68 | .probe = scm_probe, | 79 | .probe = scm_probe, |
69 | .remove = scm_remove, | 80 | .remove = scm_remove, |
70 | .handler = scm_blk_irq, | 81 | .handler = scm_blk_irq, |
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 30a2255389e5..cd798386b622 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -627,6 +627,8 @@ static int __init sclp_detect_standby_memory(void) | |||
627 | struct read_storage_sccb *sccb; | 627 | struct read_storage_sccb *sccb; |
628 | int i, id, assigned, rc; | 628 | int i, id, assigned, rc; |
629 | 629 | ||
630 | if (OLDMEM_BASE) /* No standby memory in kdump mode */ | ||
631 | return 0; | ||
630 | if (!early_read_info_sccb_valid) | 632 | if (!early_read_info_sccb_valid) |
631 | return 0; | 633 | return 0; |
632 | if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL) | 634 | if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL) |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index b907dba24025..cee69dac3e18 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
915 | int i, rc; | 915 | int i, rc; |
916 | 916 | ||
917 | /* Check if the tty3270 is already there. */ | 917 | /* Check if the tty3270 is already there. */ |
918 | view = raw3270_find_view(&tty3270_fn, tty->index); | 918 | view = raw3270_find_view(&tty3270_fn, tty->index + RAW3270_FIRSTMINOR); |
919 | if (!IS_ERR(view)) { | 919 | if (!IS_ERR(view)) { |
920 | tp = container_of(view, struct tty3270, view); | 920 | tp = container_of(view, struct tty3270, view); |
921 | tty->driver_data = tp; | 921 | tty->driver_data = tp; |
@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
927 | tp->inattr = TF_INPUT; | 927 | tp->inattr = TF_INPUT; |
928 | return tty_port_install(&tp->port, driver, tty); | 928 | return tty_port_install(&tp->port, driver, tty); |
929 | } | 929 | } |
930 | if (tty3270_max_index < tty->index) | 930 | if (tty3270_max_index < tty->index + 1) |
931 | tty3270_max_index = tty->index; | 931 | tty3270_max_index = tty->index + 1; |
932 | 932 | ||
933 | /* Allocate tty3270 structure on first open. */ | 933 | /* Allocate tty3270 structure on first open. */ |
934 | tp = tty3270_alloc_view(); | 934 | tp = tty3270_alloc_view(); |
935 | if (IS_ERR(tp)) | 935 | if (IS_ERR(tp)) |
936 | return PTR_ERR(tp); | 936 | return PTR_ERR(tp); |
937 | 937 | ||
938 | rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); | 938 | rc = raw3270_add_view(&tp->view, &tty3270_fn, |
939 | tty->index + RAW3270_FIRSTMINOR); | ||
939 | if (rc) { | 940 | if (rc) { |
940 | tty3270_free_view(tp); | 941 | tty3270_free_view(tp); |
941 | return rc; | 942 | return rc; |
@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = { | |||
1846 | 1847 | ||
1847 | void tty3270_create_cb(int minor) | 1848 | void tty3270_create_cb(int minor) |
1848 | { | 1849 | { |
1849 | tty_register_device(tty3270_driver, minor, NULL); | 1850 | tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL); |
1850 | } | 1851 | } |
1851 | 1852 | ||
1852 | void tty3270_destroy_cb(int minor) | 1853 | void tty3270_destroy_cb(int minor) |
1853 | { | 1854 | { |
1854 | tty_unregister_device(tty3270_driver, minor); | 1855 | tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR); |
1855 | } | 1856 | } |
1856 | 1857 | ||
1857 | struct raw3270_notifier tty3270_notifier = | 1858 | struct raw3270_notifier tty3270_notifier = |
@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void) | |||
1884 | driver->driver_name = "tty3270"; | 1885 | driver->driver_name = "tty3270"; |
1885 | driver->name = "3270/tty"; | 1886 | driver->name = "3270/tty"; |
1886 | driver->major = IBM_TTY3270_MAJOR; | 1887 | driver->major = IBM_TTY3270_MAJOR; |
1887 | driver->minor_start = 0; | 1888 | driver->minor_start = RAW3270_FIRSTMINOR; |
1889 | driver->name_base = RAW3270_FIRSTMINOR; | ||
1888 | driver->type = TTY_DRIVER_TYPE_SYSTEM; | 1890 | driver->type = TTY_DRIVER_TYPE_SYSTEM; |
1889 | driver->subtype = SYSTEM_TYPE_TTY; | 1891 | driver->subtype = SYSTEM_TYPE_TTY; |
1890 | driver->init_termios = tty_std_termios; | 1892 | driver->init_termios = tty_std_termios; |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 31ceef1beb8b..e16c553f6556 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -433,6 +433,20 @@ static void chsc_process_sei_scm_change(struct chsc_sei_nt0_area *sei_area) | |||
433 | " failed (rc=%d).\n", ret); | 433 | " failed (rc=%d).\n", ret); |
434 | } | 434 | } |
435 | 435 | ||
436 | static void chsc_process_sei_scm_avail(struct chsc_sei_nt0_area *sei_area) | ||
437 | { | ||
438 | int ret; | ||
439 | |||
440 | CIO_CRW_EVENT(4, "chsc: scm available information\n"); | ||
441 | if (sei_area->rs != 7) | ||
442 | return; | ||
443 | |||
444 | ret = scm_process_availability_information(); | ||
445 | if (ret) | ||
446 | CIO_CRW_EVENT(0, "chsc: process availability information" | ||
447 | " failed (rc=%d).\n", ret); | ||
448 | } | ||
449 | |||
436 | static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) | 450 | static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) |
437 | { | 451 | { |
438 | switch (sei_area->cc) { | 452 | switch (sei_area->cc) { |
@@ -468,6 +482,9 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area) | |||
468 | case 12: /* scm change notification */ | 482 | case 12: /* scm change notification */ |
469 | chsc_process_sei_scm_change(sei_area); | 483 | chsc_process_sei_scm_change(sei_area); |
470 | break; | 484 | break; |
485 | case 14: /* scm available notification */ | ||
486 | chsc_process_sei_scm_avail(sei_area); | ||
487 | break; | ||
471 | default: /* other stuff */ | 488 | default: /* other stuff */ |
472 | CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n", | 489 | CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n", |
473 | sei_area->cc); | 490 | sei_area->cc); |
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h index 227e05f674b3..349d5fc47196 100644 --- a/drivers/s390/cio/chsc.h +++ b/drivers/s390/cio/chsc.h | |||
@@ -156,8 +156,10 @@ int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); | |||
156 | 156 | ||
157 | #ifdef CONFIG_SCM_BUS | 157 | #ifdef CONFIG_SCM_BUS |
158 | int scm_update_information(void); | 158 | int scm_update_information(void); |
159 | int scm_process_availability_information(void); | ||
159 | #else /* CONFIG_SCM_BUS */ | 160 | #else /* CONFIG_SCM_BUS */ |
160 | static inline int scm_update_information(void) { return 0; } | 161 | static inline int scm_update_information(void) { return 0; } |
162 | static inline int scm_process_availability_information(void) { return 0; } | ||
161 | #endif /* CONFIG_SCM_BUS */ | 163 | #endif /* CONFIG_SCM_BUS */ |
162 | 164 | ||
163 | 165 | ||
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c index bcf20f3aa51b..46ec25632e8b 100644 --- a/drivers/s390/cio/scm.c +++ b/drivers/s390/cio/scm.c | |||
@@ -211,7 +211,7 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale) | |||
211 | goto out; | 211 | goto out; |
212 | scmdrv = to_scm_drv(scmdev->dev.driver); | 212 | scmdrv = to_scm_drv(scmdev->dev.driver); |
213 | if (changed && scmdrv->notify) | 213 | if (changed && scmdrv->notify) |
214 | scmdrv->notify(scmdev); | 214 | scmdrv->notify(scmdev, SCM_CHANGE); |
215 | out: | 215 | out: |
216 | device_unlock(&scmdev->dev); | 216 | device_unlock(&scmdev->dev); |
217 | if (changed) | 217 | if (changed) |
@@ -297,6 +297,22 @@ int scm_update_information(void) | |||
297 | return ret; | 297 | return ret; |
298 | } | 298 | } |
299 | 299 | ||
300 | static int scm_dev_avail(struct device *dev, void *unused) | ||
301 | { | ||
302 | struct scm_driver *scmdrv = to_scm_drv(dev->driver); | ||
303 | struct scm_device *scmdev = to_scm_dev(dev); | ||
304 | |||
305 | if (dev->driver && scmdrv->notify) | ||
306 | scmdrv->notify(scmdev, SCM_AVAIL); | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | int scm_process_availability_information(void) | ||
312 | { | ||
313 | return bus_for_each_dev(&scm_bus_type, NULL, NULL, scm_dev_avail); | ||
314 | } | ||
315 | |||
300 | static int __init scm_init(void) | 316 | static int __init scm_init(void) |
301 | { | 317 | { |
302 | int ret; | 318 | int ret; |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index d87961d4c0de..6ccb7457746b 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -769,6 +769,7 @@ struct qeth_card { | |||
769 | unsigned long thread_start_mask; | 769 | unsigned long thread_start_mask; |
770 | unsigned long thread_allowed_mask; | 770 | unsigned long thread_allowed_mask; |
771 | unsigned long thread_running_mask; | 771 | unsigned long thread_running_mask; |
772 | struct task_struct *recovery_task; | ||
772 | spinlock_t ip_lock; | 773 | spinlock_t ip_lock; |
773 | struct list_head ip_list; | 774 | struct list_head ip_list; |
774 | struct list_head *ip_tbd_list; | 775 | struct list_head *ip_tbd_list; |
@@ -862,6 +863,8 @@ extern struct qeth_card_list_struct qeth_core_card_list; | |||
862 | extern struct kmem_cache *qeth_core_header_cache; | 863 | extern struct kmem_cache *qeth_core_header_cache; |
863 | extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; | 864 | extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; |
864 | 865 | ||
866 | void qeth_set_recovery_task(struct qeth_card *); | ||
867 | void qeth_clear_recovery_task(struct qeth_card *); | ||
865 | void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); | 868 | void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); |
866 | int qeth_threads_running(struct qeth_card *, unsigned long); | 869 | int qeth_threads_running(struct qeth_card *, unsigned long); |
867 | int qeth_wait_for_threads(struct qeth_card *, unsigned long); | 870 | int qeth_wait_for_threads(struct qeth_card *, unsigned long); |
@@ -916,6 +919,7 @@ int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *, | |||
916 | void *reply_param); | 919 | void *reply_param); |
917 | int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); | 920 | int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); |
918 | int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); | 921 | int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); |
922 | int qeth_get_elements_for_frags(struct sk_buff *); | ||
919 | int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, | 923 | int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, |
920 | struct sk_buff *, struct qeth_hdr *, int, int, int); | 924 | struct sk_buff *, struct qeth_hdr *, int, int, int); |
921 | int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, | 925 | int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 0d8cdff81813..451f92020599 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -177,6 +177,23 @@ const char *qeth_get_cardname_short(struct qeth_card *card) | |||
177 | return "n/a"; | 177 | return "n/a"; |
178 | } | 178 | } |
179 | 179 | ||
180 | void qeth_set_recovery_task(struct qeth_card *card) | ||
181 | { | ||
182 | card->recovery_task = current; | ||
183 | } | ||
184 | EXPORT_SYMBOL_GPL(qeth_set_recovery_task); | ||
185 | |||
186 | void qeth_clear_recovery_task(struct qeth_card *card) | ||
187 | { | ||
188 | card->recovery_task = NULL; | ||
189 | } | ||
190 | EXPORT_SYMBOL_GPL(qeth_clear_recovery_task); | ||
191 | |||
192 | static bool qeth_is_recovery_task(const struct qeth_card *card) | ||
193 | { | ||
194 | return card->recovery_task == current; | ||
195 | } | ||
196 | |||
180 | void qeth_set_allowed_threads(struct qeth_card *card, unsigned long threads, | 197 | void qeth_set_allowed_threads(struct qeth_card *card, unsigned long threads, |
181 | int clear_start_mask) | 198 | int clear_start_mask) |
182 | { | 199 | { |
@@ -205,6 +222,8 @@ EXPORT_SYMBOL_GPL(qeth_threads_running); | |||
205 | 222 | ||
206 | int qeth_wait_for_threads(struct qeth_card *card, unsigned long threads) | 223 | int qeth_wait_for_threads(struct qeth_card *card, unsigned long threads) |
207 | { | 224 | { |
225 | if (qeth_is_recovery_task(card)) | ||
226 | return 0; | ||
208 | return wait_event_interruptible(card->wait_q, | 227 | return wait_event_interruptible(card->wait_q, |
209 | qeth_threads_running(card, threads) == 0); | 228 | qeth_threads_running(card, threads) == 0); |
210 | } | 229 | } |
@@ -3679,6 +3698,25 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb, | |||
3679 | } | 3698 | } |
3680 | EXPORT_SYMBOL_GPL(qeth_get_priority_queue); | 3699 | EXPORT_SYMBOL_GPL(qeth_get_priority_queue); |
3681 | 3700 | ||
3701 | int qeth_get_elements_for_frags(struct sk_buff *skb) | ||
3702 | { | ||
3703 | int cnt, length, e, elements = 0; | ||
3704 | struct skb_frag_struct *frag; | ||
3705 | char *data; | ||
3706 | |||
3707 | for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { | ||
3708 | frag = &skb_shinfo(skb)->frags[cnt]; | ||
3709 | data = (char *)page_to_phys(skb_frag_page(frag)) + | ||
3710 | frag->page_offset; | ||
3711 | length = frag->size; | ||
3712 | e = PFN_UP((unsigned long)data + length - 1) - | ||
3713 | PFN_DOWN((unsigned long)data); | ||
3714 | elements += e; | ||
3715 | } | ||
3716 | return elements; | ||
3717 | } | ||
3718 | EXPORT_SYMBOL_GPL(qeth_get_elements_for_frags); | ||
3719 | |||
3682 | int qeth_get_elements_no(struct qeth_card *card, void *hdr, | 3720 | int qeth_get_elements_no(struct qeth_card *card, void *hdr, |
3683 | struct sk_buff *skb, int elems) | 3721 | struct sk_buff *skb, int elems) |
3684 | { | 3722 | { |
@@ -3686,7 +3724,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr, | |||
3686 | int elements_needed = PFN_UP((unsigned long)skb->data + dlen - 1) - | 3724 | int elements_needed = PFN_UP((unsigned long)skb->data + dlen - 1) - |
3687 | PFN_DOWN((unsigned long)skb->data); | 3725 | PFN_DOWN((unsigned long)skb->data); |
3688 | 3726 | ||
3689 | elements_needed += skb_shinfo(skb)->nr_frags; | 3727 | elements_needed += qeth_get_elements_for_frags(skb); |
3728 | |||
3690 | if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { | 3729 | if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { |
3691 | QETH_DBF_MESSAGE(2, "Invalid size of IP packet " | 3730 | QETH_DBF_MESSAGE(2, "Invalid size of IP packet " |
3692 | "(Number=%d / Length=%d). Discarded.\n", | 3731 | "(Number=%d / Length=%d). Discarded.\n", |
@@ -3771,12 +3810,23 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, | |||
3771 | 3810 | ||
3772 | for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { | 3811 | for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { |
3773 | frag = &skb_shinfo(skb)->frags[cnt]; | 3812 | frag = &skb_shinfo(skb)->frags[cnt]; |
3774 | buffer->element[element].addr = (char *) | 3813 | data = (char *)page_to_phys(skb_frag_page(frag)) + |
3775 | page_to_phys(skb_frag_page(frag)) | 3814 | frag->page_offset; |
3776 | + frag->page_offset; | 3815 | length = frag->size; |
3777 | buffer->element[element].length = frag->size; | 3816 | while (length > 0) { |
3778 | buffer->element[element].eflags = SBAL_EFLAGS_MIDDLE_FRAG; | 3817 | length_here = PAGE_SIZE - |
3779 | element++; | 3818 | ((unsigned long) data % PAGE_SIZE); |
3819 | if (length < length_here) | ||
3820 | length_here = length; | ||
3821 | |||
3822 | buffer->element[element].addr = data; | ||
3823 | buffer->element[element].length = length_here; | ||
3824 | buffer->element[element].eflags = | ||
3825 | SBAL_EFLAGS_MIDDLE_FRAG; | ||
3826 | length -= length_here; | ||
3827 | data += length_here; | ||
3828 | element++; | ||
3829 | } | ||
3780 | } | 3830 | } |
3781 | 3831 | ||
3782 | if (buffer->element[element - 1].eflags) | 3832 | if (buffer->element[element - 1].eflags) |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index d690166efeaf..155b101bd730 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -1143,6 +1143,7 @@ static int qeth_l2_recover(void *ptr) | |||
1143 | QETH_CARD_TEXT(card, 2, "recover2"); | 1143 | QETH_CARD_TEXT(card, 2, "recover2"); |
1144 | dev_warn(&card->gdev->dev, | 1144 | dev_warn(&card->gdev->dev, |
1145 | "A recovery process has been started for the device\n"); | 1145 | "A recovery process has been started for the device\n"); |
1146 | qeth_set_recovery_task(card); | ||
1146 | __qeth_l2_set_offline(card->gdev, 1); | 1147 | __qeth_l2_set_offline(card->gdev, 1); |
1147 | rc = __qeth_l2_set_online(card->gdev, 1); | 1148 | rc = __qeth_l2_set_online(card->gdev, 1); |
1148 | if (!rc) | 1149 | if (!rc) |
@@ -1153,6 +1154,7 @@ static int qeth_l2_recover(void *ptr) | |||
1153 | dev_warn(&card->gdev->dev, "The qeth device driver " | 1154 | dev_warn(&card->gdev->dev, "The qeth device driver " |
1154 | "failed to recover an error on the device\n"); | 1155 | "failed to recover an error on the device\n"); |
1155 | } | 1156 | } |
1157 | qeth_clear_recovery_task(card); | ||
1156 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); | 1158 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); |
1157 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); | 1159 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); |
1158 | return 0; | 1160 | return 0; |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 091ca0efa1c5..1f7edf1b26c3 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -623,7 +623,7 @@ static int qeth_l3_send_setrouting(struct qeth_card *card, | |||
623 | return rc; | 623 | return rc; |
624 | } | 624 | } |
625 | 625 | ||
626 | static void qeth_l3_correct_routing_type(struct qeth_card *card, | 626 | static int qeth_l3_correct_routing_type(struct qeth_card *card, |
627 | enum qeth_routing_types *type, enum qeth_prot_versions prot) | 627 | enum qeth_routing_types *type, enum qeth_prot_versions prot) |
628 | { | 628 | { |
629 | if (card->info.type == QETH_CARD_TYPE_IQD) { | 629 | if (card->info.type == QETH_CARD_TYPE_IQD) { |
@@ -632,7 +632,7 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card, | |||
632 | case PRIMARY_CONNECTOR: | 632 | case PRIMARY_CONNECTOR: |
633 | case SECONDARY_CONNECTOR: | 633 | case SECONDARY_CONNECTOR: |
634 | case MULTICAST_ROUTER: | 634 | case MULTICAST_ROUTER: |
635 | return; | 635 | return 0; |
636 | default: | 636 | default: |
637 | goto out_inval; | 637 | goto out_inval; |
638 | } | 638 | } |
@@ -641,17 +641,18 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card, | |||
641 | case NO_ROUTER: | 641 | case NO_ROUTER: |
642 | case PRIMARY_ROUTER: | 642 | case PRIMARY_ROUTER: |
643 | case SECONDARY_ROUTER: | 643 | case SECONDARY_ROUTER: |
644 | return; | 644 | return 0; |
645 | case MULTICAST_ROUTER: | 645 | case MULTICAST_ROUTER: |
646 | if (qeth_is_ipafunc_supported(card, prot, | 646 | if (qeth_is_ipafunc_supported(card, prot, |
647 | IPA_OSA_MC_ROUTER)) | 647 | IPA_OSA_MC_ROUTER)) |
648 | return; | 648 | return 0; |
649 | default: | 649 | default: |
650 | goto out_inval; | 650 | goto out_inval; |
651 | } | 651 | } |
652 | } | 652 | } |
653 | out_inval: | 653 | out_inval: |
654 | *type = NO_ROUTER; | 654 | *type = NO_ROUTER; |
655 | return -EINVAL; | ||
655 | } | 656 | } |
656 | 657 | ||
657 | int qeth_l3_setrouting_v4(struct qeth_card *card) | 658 | int qeth_l3_setrouting_v4(struct qeth_card *card) |
@@ -660,8 +661,10 @@ int qeth_l3_setrouting_v4(struct qeth_card *card) | |||
660 | 661 | ||
661 | QETH_CARD_TEXT(card, 3, "setrtg4"); | 662 | QETH_CARD_TEXT(card, 3, "setrtg4"); |
662 | 663 | ||
663 | qeth_l3_correct_routing_type(card, &card->options.route4.type, | 664 | rc = qeth_l3_correct_routing_type(card, &card->options.route4.type, |
664 | QETH_PROT_IPV4); | 665 | QETH_PROT_IPV4); |
666 | if (rc) | ||
667 | return rc; | ||
665 | 668 | ||
666 | rc = qeth_l3_send_setrouting(card, card->options.route4.type, | 669 | rc = qeth_l3_send_setrouting(card, card->options.route4.type, |
667 | QETH_PROT_IPV4); | 670 | QETH_PROT_IPV4); |
@@ -683,8 +686,10 @@ int qeth_l3_setrouting_v6(struct qeth_card *card) | |||
683 | 686 | ||
684 | if (!qeth_is_supported(card, IPA_IPV6)) | 687 | if (!qeth_is_supported(card, IPA_IPV6)) |
685 | return 0; | 688 | return 0; |
686 | qeth_l3_correct_routing_type(card, &card->options.route6.type, | 689 | rc = qeth_l3_correct_routing_type(card, &card->options.route6.type, |
687 | QETH_PROT_IPV6); | 690 | QETH_PROT_IPV6); |
691 | if (rc) | ||
692 | return rc; | ||
688 | 693 | ||
689 | rc = qeth_l3_send_setrouting(card, card->options.route6.type, | 694 | rc = qeth_l3_send_setrouting(card, card->options.route6.type, |
690 | QETH_PROT_IPV6); | 695 | QETH_PROT_IPV6); |
@@ -2898,7 +2903,9 @@ static inline int qeth_l3_tso_elements(struct sk_buff *skb) | |||
2898 | tcp_hdr(skb)->doff * 4; | 2903 | tcp_hdr(skb)->doff * 4; |
2899 | int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data); | 2904 | int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data); |
2900 | int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd); | 2905 | int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd); |
2901 | elements += skb_shinfo(skb)->nr_frags; | 2906 | |
2907 | elements += qeth_get_elements_for_frags(skb); | ||
2908 | |||
2902 | return elements; | 2909 | return elements; |
2903 | } | 2910 | } |
2904 | 2911 | ||
@@ -3348,7 +3355,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3348 | rc = -ENODEV; | 3355 | rc = -ENODEV; |
3349 | goto out_remove; | 3356 | goto out_remove; |
3350 | } | 3357 | } |
3351 | qeth_trace_features(card); | ||
3352 | 3358 | ||
3353 | if (!card->dev && qeth_l3_setup_netdev(card)) { | 3359 | if (!card->dev && qeth_l3_setup_netdev(card)) { |
3354 | rc = -ENODEV; | 3360 | rc = -ENODEV; |
@@ -3425,6 +3431,7 @@ contin: | |||
3425 | qeth_l3_set_multicast_list(card->dev); | 3431 | qeth_l3_set_multicast_list(card->dev); |
3426 | rtnl_unlock(); | 3432 | rtnl_unlock(); |
3427 | } | 3433 | } |
3434 | qeth_trace_features(card); | ||
3428 | /* let user_space know that device is online */ | 3435 | /* let user_space know that device is online */ |
3429 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); | 3436 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); |
3430 | mutex_unlock(&card->conf_mutex); | 3437 | mutex_unlock(&card->conf_mutex); |
@@ -3508,6 +3515,7 @@ static int qeth_l3_recover(void *ptr) | |||
3508 | QETH_CARD_TEXT(card, 2, "recover2"); | 3515 | QETH_CARD_TEXT(card, 2, "recover2"); |
3509 | dev_warn(&card->gdev->dev, | 3516 | dev_warn(&card->gdev->dev, |
3510 | "A recovery process has been started for the device\n"); | 3517 | "A recovery process has been started for the device\n"); |
3518 | qeth_set_recovery_task(card); | ||
3511 | __qeth_l3_set_offline(card->gdev, 1); | 3519 | __qeth_l3_set_offline(card->gdev, 1); |
3512 | rc = __qeth_l3_set_online(card->gdev, 1); | 3520 | rc = __qeth_l3_set_online(card->gdev, 1); |
3513 | if (!rc) | 3521 | if (!rc) |
@@ -3518,6 +3526,7 @@ static int qeth_l3_recover(void *ptr) | |||
3518 | dev_warn(&card->gdev->dev, "The qeth device driver " | 3526 | dev_warn(&card->gdev->dev, "The qeth device driver " |
3519 | "failed to recover an error on the device\n"); | 3527 | "failed to recover an error on the device\n"); |
3520 | } | 3528 | } |
3529 | qeth_clear_recovery_task(card); | ||
3521 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); | 3530 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); |
3522 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); | 3531 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); |
3523 | return 0; | 3532 | return 0; |
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index ebc379486267..e70af2406ff9 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c | |||
@@ -87,6 +87,8 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card, | |||
87 | rc = qeth_l3_setrouting_v6(card); | 87 | rc = qeth_l3_setrouting_v6(card); |
88 | } | 88 | } |
89 | out: | 89 | out: |
90 | if (rc) | ||
91 | route->type = old_route_type; | ||
90 | mutex_unlock(&card->conf_mutex); | 92 | mutex_unlock(&card->conf_mutex); |
91 | return rc ? rc : count; | 93 | return rc ? rc : count; |
92 | } | 94 | } |
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index 1a9d1e3ce64c..c1441ed282eb 100644 --- a/drivers/sbus/char/bbc_i2c.c +++ b/drivers/sbus/char/bbc_i2c.c | |||
@@ -282,7 +282,7 @@ static irqreturn_t bbc_i2c_interrupt(int irq, void *dev_id) | |||
282 | return IRQ_HANDLED; | 282 | return IRQ_HANDLED; |
283 | } | 283 | } |
284 | 284 | ||
285 | static void __init reset_one_i2c(struct bbc_i2c_bus *bp) | 285 | static void reset_one_i2c(struct bbc_i2c_bus *bp) |
286 | { | 286 | { |
287 | writeb(I2C_PCF_PIN, bp->i2c_control_regs + 0x0); | 287 | writeb(I2C_PCF_PIN, bp->i2c_control_regs + 0x0); |
288 | writeb(bp->own, bp->i2c_control_regs + 0x1); | 288 | writeb(bp->own, bp->i2c_control_regs + 0x1); |
@@ -291,7 +291,7 @@ static void __init reset_one_i2c(struct bbc_i2c_bus *bp) | |||
291 | writeb(I2C_PCF_IDLE, bp->i2c_control_regs + 0x0); | 291 | writeb(I2C_PCF_IDLE, bp->i2c_control_regs + 0x0); |
292 | } | 292 | } |
293 | 293 | ||
294 | static struct bbc_i2c_bus * __init attach_one_i2c(struct platform_device *op, int index) | 294 | static struct bbc_i2c_bus * attach_one_i2c(struct platform_device *op, int index) |
295 | { | 295 | { |
296 | struct bbc_i2c_bus *bp; | 296 | struct bbc_i2c_bus *bp; |
297 | struct device_node *dp; | 297 | struct device_node *dp; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 2daf4b0da434..90bc7bd00966 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -940,6 +940,7 @@ static int bnx2fc_libfc_config(struct fc_lport *lport) | |||
940 | fc_exch_init(lport); | 940 | fc_exch_init(lport); |
941 | fc_rport_init(lport); | 941 | fc_rport_init(lport); |
942 | fc_disc_init(lport); | 942 | fc_disc_init(lport); |
943 | fc_disc_config(lport, lport); | ||
943 | return 0; | 944 | return 0; |
944 | } | 945 | } |
945 | 946 | ||
@@ -2133,6 +2134,7 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2133 | } | 2134 | } |
2134 | 2135 | ||
2135 | ctlr = bnx2fc_to_ctlr(interface); | 2136 | ctlr = bnx2fc_to_ctlr(interface); |
2137 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2136 | interface->vlan_id = vlan_id; | 2138 | interface->vlan_id = vlan_id; |
2137 | 2139 | ||
2138 | interface->timer_work_queue = | 2140 | interface->timer_work_queue = |
@@ -2143,7 +2145,7 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2143 | goto ifput_err; | 2145 | goto ifput_err; |
2144 | } | 2146 | } |
2145 | 2147 | ||
2146 | lport = bnx2fc_if_create(interface, &interface->hba->pcidev->dev, 0); | 2148 | lport = bnx2fc_if_create(interface, &cdev->dev, 0); |
2147 | if (!lport) { | 2149 | if (!lport) { |
2148 | printk(KERN_ERR PFX "Failed to create interface (%s)\n", | 2150 | printk(KERN_ERR PFX "Failed to create interface (%s)\n", |
2149 | netdev->name); | 2151 | netdev->name); |
@@ -2159,8 +2161,6 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2159 | /* Make this master N_port */ | 2161 | /* Make this master N_port */ |
2160 | ctlr->lp = lport; | 2162 | ctlr->lp = lport; |
2161 | 2163 | ||
2162 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2163 | |||
2164 | if (link_state == BNX2FC_CREATE_LINK_UP) | 2164 | if (link_state == BNX2FC_CREATE_LINK_UP) |
2165 | cdev->enabled = FCOE_CTLR_ENABLED; | 2165 | cdev->enabled = FCOE_CTLR_ENABLED; |
2166 | else | 2166 | else |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index b5d92fc93c70..9bfdc9a3f897 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -490,7 +490,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
490 | { | 490 | { |
491 | struct net_device *netdev = fcoe->netdev; | 491 | struct net_device *netdev = fcoe->netdev; |
492 | struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); | 492 | struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); |
493 | struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); | ||
494 | 493 | ||
495 | rtnl_lock(); | 494 | rtnl_lock(); |
496 | if (!fcoe->removed) | 495 | if (!fcoe->removed) |
@@ -501,7 +500,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
501 | /* tear-down the FCoE controller */ | 500 | /* tear-down the FCoE controller */ |
502 | fcoe_ctlr_destroy(fip); | 501 | fcoe_ctlr_destroy(fip); |
503 | scsi_host_put(fip->lp->host); | 502 | scsi_host_put(fip->lp->host); |
504 | fcoe_ctlr_device_delete(ctlr_dev); | ||
505 | dev_put(netdev); | 503 | dev_put(netdev); |
506 | module_put(THIS_MODULE); | 504 | module_put(THIS_MODULE); |
507 | } | 505 | } |
@@ -2194,6 +2192,8 @@ out_nodev: | |||
2194 | */ | 2192 | */ |
2195 | static void fcoe_destroy_work(struct work_struct *work) | 2193 | static void fcoe_destroy_work(struct work_struct *work) |
2196 | { | 2194 | { |
2195 | struct fcoe_ctlr_device *cdev; | ||
2196 | struct fcoe_ctlr *ctlr; | ||
2197 | struct fcoe_port *port; | 2197 | struct fcoe_port *port; |
2198 | struct fcoe_interface *fcoe; | 2198 | struct fcoe_interface *fcoe; |
2199 | struct Scsi_Host *shost; | 2199 | struct Scsi_Host *shost; |
@@ -2224,10 +2224,15 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
2224 | mutex_lock(&fcoe_config_mutex); | 2224 | mutex_lock(&fcoe_config_mutex); |
2225 | 2225 | ||
2226 | fcoe = port->priv; | 2226 | fcoe = port->priv; |
2227 | ctlr = fcoe_to_ctlr(fcoe); | ||
2228 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2229 | |||
2227 | fcoe_if_destroy(port->lport); | 2230 | fcoe_if_destroy(port->lport); |
2228 | fcoe_interface_cleanup(fcoe); | 2231 | fcoe_interface_cleanup(fcoe); |
2229 | 2232 | ||
2230 | mutex_unlock(&fcoe_config_mutex); | 2233 | mutex_unlock(&fcoe_config_mutex); |
2234 | |||
2235 | fcoe_ctlr_device_delete(cdev); | ||
2231 | } | 2236 | } |
2232 | 2237 | ||
2233 | /** | 2238 | /** |
@@ -2335,7 +2340,9 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode, | |||
2335 | rc = -EIO; | 2340 | rc = -EIO; |
2336 | rtnl_unlock(); | 2341 | rtnl_unlock(); |
2337 | fcoe_interface_cleanup(fcoe); | 2342 | fcoe_interface_cleanup(fcoe); |
2338 | goto out_nortnl; | 2343 | mutex_unlock(&fcoe_config_mutex); |
2344 | fcoe_ctlr_device_delete(ctlr_dev); | ||
2345 | goto out; | ||
2339 | } | 2346 | } |
2340 | 2347 | ||
2341 | /* Make this the "master" N_Port */ | 2348 | /* Make this the "master" N_Port */ |
@@ -2375,8 +2382,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode, | |||
2375 | 2382 | ||
2376 | out_nodev: | 2383 | out_nodev: |
2377 | rtnl_unlock(); | 2384 | rtnl_unlock(); |
2378 | out_nortnl: | ||
2379 | mutex_unlock(&fcoe_config_mutex); | 2385 | mutex_unlock(&fcoe_config_mutex); |
2386 | out: | ||
2380 | return rc; | 2387 | return rc; |
2381 | } | 2388 | } |
2382 | 2389 | ||
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index 08c3bc398da2..a76247201be5 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c | |||
@@ -2815,6 +2815,47 @@ unlock: | |||
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | /** | 2817 | /** |
2818 | * fcoe_ctlr_mode_set() - Set or reset the ctlr's mode | ||
2819 | * @lport: The local port to be (re)configured | ||
2820 | * @fip: The FCoE controller whose mode is changing | ||
2821 | * @fip_mode: The new fip mode | ||
2822 | * | ||
2823 | * Note that the we shouldn't be changing the libfc discovery settings | ||
2824 | * (fc_disc_config) while an lport is going through the libfc state | ||
2825 | * machine. The mode can only be changed when a fcoe_ctlr device is | ||
2826 | * disabled, so that should ensure that this routine is only called | ||
2827 | * when nothing is happening. | ||
2828 | */ | ||
2829 | void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip, | ||
2830 | enum fip_state fip_mode) | ||
2831 | { | ||
2832 | void *priv; | ||
2833 | |||
2834 | WARN_ON(lport->state != LPORT_ST_RESET && | ||
2835 | lport->state != LPORT_ST_DISABLED); | ||
2836 | |||
2837 | if (fip_mode == FIP_MODE_VN2VN) { | ||
2838 | lport->rport_priv_size = sizeof(struct fcoe_rport); | ||
2839 | lport->point_to_multipoint = 1; | ||
2840 | lport->tt.disc_recv_req = fcoe_ctlr_disc_recv; | ||
2841 | lport->tt.disc_start = fcoe_ctlr_disc_start; | ||
2842 | lport->tt.disc_stop = fcoe_ctlr_disc_stop; | ||
2843 | lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final; | ||
2844 | priv = fip; | ||
2845 | } else { | ||
2846 | lport->rport_priv_size = 0; | ||
2847 | lport->point_to_multipoint = 0; | ||
2848 | lport->tt.disc_recv_req = NULL; | ||
2849 | lport->tt.disc_start = NULL; | ||
2850 | lport->tt.disc_stop = NULL; | ||
2851 | lport->tt.disc_stop_final = NULL; | ||
2852 | priv = lport; | ||
2853 | } | ||
2854 | |||
2855 | fc_disc_config(lport, priv); | ||
2856 | } | ||
2857 | |||
2858 | /** | ||
2818 | * fcoe_libfc_config() - Sets up libfc related properties for local port | 2859 | * fcoe_libfc_config() - Sets up libfc related properties for local port |
2819 | * @lport: The local port to configure libfc for | 2860 | * @lport: The local port to configure libfc for |
2820 | * @fip: The FCoE controller in use by the local port | 2861 | * @fip: The FCoE controller in use by the local port |
@@ -2833,21 +2874,9 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip, | |||
2833 | fc_exch_init(lport); | 2874 | fc_exch_init(lport); |
2834 | fc_elsct_init(lport); | 2875 | fc_elsct_init(lport); |
2835 | fc_lport_init(lport); | 2876 | fc_lport_init(lport); |
2836 | if (fip->mode == FIP_MODE_VN2VN) | ||
2837 | lport->rport_priv_size = sizeof(struct fcoe_rport); | ||
2838 | fc_rport_init(lport); | 2877 | fc_rport_init(lport); |
2839 | if (fip->mode == FIP_MODE_VN2VN) { | 2878 | fc_disc_init(lport); |
2840 | lport->point_to_multipoint = 1; | 2879 | fcoe_ctlr_mode_set(lport, fip, fip->mode); |
2841 | lport->tt.disc_recv_req = fcoe_ctlr_disc_recv; | ||
2842 | lport->tt.disc_start = fcoe_ctlr_disc_start; | ||
2843 | lport->tt.disc_stop = fcoe_ctlr_disc_stop; | ||
2844 | lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final; | ||
2845 | mutex_init(&lport->disc.disc_mutex); | ||
2846 | INIT_LIST_HEAD(&lport->disc.rports); | ||
2847 | lport->disc.priv = fip; | ||
2848 | } else { | ||
2849 | fc_disc_init(lport); | ||
2850 | } | ||
2851 | return 0; | 2880 | return 0; |
2852 | } | 2881 | } |
2853 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); | 2882 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); |
@@ -2875,6 +2904,7 @@ EXPORT_SYMBOL(fcoe_fcf_get_selected); | |||
2875 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) | 2904 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) |
2876 | { | 2905 | { |
2877 | struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); | 2906 | struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); |
2907 | struct fc_lport *lport = ctlr->lp; | ||
2878 | 2908 | ||
2879 | mutex_lock(&ctlr->ctlr_mutex); | 2909 | mutex_lock(&ctlr->ctlr_mutex); |
2880 | switch (ctlr_dev->mode) { | 2910 | switch (ctlr_dev->mode) { |
@@ -2888,5 +2918,7 @@ void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) | |||
2888 | } | 2918 | } |
2889 | 2919 | ||
2890 | mutex_unlock(&ctlr->ctlr_mutex); | 2920 | mutex_unlock(&ctlr->ctlr_mutex); |
2921 | |||
2922 | fcoe_ctlr_mode_set(lport, ctlr, ctlr->mode); | ||
2891 | } | 2923 | } |
2892 | EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); | 2924 | EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index a044f593e8b9..d0fa4b6c551f 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1899,8 +1899,8 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev) | |||
1899 | sdev->allow_restart = 1; | 1899 | sdev->allow_restart = 1; |
1900 | blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); | 1900 | blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); |
1901 | } | 1901 | } |
1902 | scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun); | ||
1903 | spin_unlock_irqrestore(shost->host_lock, lock_flags); | 1902 | spin_unlock_irqrestore(shost->host_lock, lock_flags); |
1903 | scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun); | ||
1904 | return 0; | 1904 | return 0; |
1905 | } | 1905 | } |
1906 | 1906 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index f328089a1060..2197b57fb225 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -5148,7 +5148,7 @@ static int ipr_cancel_op(struct scsi_cmnd *scsi_cmd) | |||
5148 | ipr_trace; | 5148 | ipr_trace; |
5149 | } | 5149 | } |
5150 | 5150 | ||
5151 | list_add_tail(&ipr_cmd->queue, &hrrq->hrrq_free_q); | 5151 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
5152 | if (!ipr_is_naca_model(res)) | 5152 | if (!ipr_is_naca_model(res)) |
5153 | res->needs_sync_complete = 1; | 5153 | res->needs_sync_complete = 1; |
5154 | 5154 | ||
@@ -9349,7 +9349,10 @@ static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev) | |||
9349 | int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg); | 9349 | int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
9350 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 9350 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
9351 | 9351 | ||
9352 | rc = request_irq(pdev->irq, ipr_test_intr, 0, IPR_NAME, ioa_cfg); | 9352 | if (ioa_cfg->intr_flag == IPR_USE_MSIX) |
9353 | rc = request_irq(ioa_cfg->vectors_info[0].vec, ipr_test_intr, 0, IPR_NAME, ioa_cfg); | ||
9354 | else | ||
9355 | rc = request_irq(pdev->irq, ipr_test_intr, 0, IPR_NAME, ioa_cfg); | ||
9353 | if (rc) { | 9356 | if (rc) { |
9354 | dev_err(&pdev->dev, "Can not assign irq %d\n", pdev->irq); | 9357 | dev_err(&pdev->dev, "Can not assign irq %d\n", pdev->irq); |
9355 | return rc; | 9358 | return rc; |
@@ -9371,7 +9374,10 @@ static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev) | |||
9371 | 9374 | ||
9372 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 9375 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
9373 | 9376 | ||
9374 | free_irq(pdev->irq, ioa_cfg); | 9377 | if (ioa_cfg->intr_flag == IPR_USE_MSIX) |
9378 | free_irq(ioa_cfg->vectors_info[0].vec, ioa_cfg); | ||
9379 | else | ||
9380 | free_irq(pdev->irq, ioa_cfg); | ||
9375 | 9381 | ||
9376 | LEAVE; | 9382 | LEAVE; |
9377 | 9383 | ||
@@ -9722,6 +9728,7 @@ static void __ipr_remove(struct pci_dev *pdev) | |||
9722 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); | 9728 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); |
9723 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | 9729 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); |
9724 | flush_work(&ioa_cfg->work_q); | 9730 | flush_work(&ioa_cfg->work_q); |
9731 | INIT_LIST_HEAD(&ioa_cfg->used_res_q); | ||
9725 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | 9732 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); |
9726 | 9733 | ||
9727 | spin_lock(&ipr_driver_lock); | 9734 | spin_lock(&ipr_driver_lock); |
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8e561e6a557c..880a9068ca12 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -712,12 +712,13 @@ static void fc_disc_stop_final(struct fc_lport *lport) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | /** | 714 | /** |
715 | * fc_disc_init() - Initialize the discovery layer for a local port | 715 | * fc_disc_config() - Configure the discovery layer for a local port |
716 | * @lport: The local port that needs the discovery layer to be initialized | 716 | * @lport: The local port that needs the discovery layer to be configured |
717 | * @priv: Private data structre for users of the discovery layer | ||
717 | */ | 718 | */ |
718 | int fc_disc_init(struct fc_lport *lport) | 719 | void fc_disc_config(struct fc_lport *lport, void *priv) |
719 | { | 720 | { |
720 | struct fc_disc *disc; | 721 | struct fc_disc *disc = &lport->disc; |
721 | 722 | ||
722 | if (!lport->tt.disc_start) | 723 | if (!lport->tt.disc_start) |
723 | lport->tt.disc_start = fc_disc_start; | 724 | lport->tt.disc_start = fc_disc_start; |
@@ -732,12 +733,21 @@ int fc_disc_init(struct fc_lport *lport) | |||
732 | lport->tt.disc_recv_req = fc_disc_recv_req; | 733 | lport->tt.disc_recv_req = fc_disc_recv_req; |
733 | 734 | ||
734 | disc = &lport->disc; | 735 | disc = &lport->disc; |
736 | |||
737 | disc->priv = priv; | ||
738 | } | ||
739 | EXPORT_SYMBOL(fc_disc_config); | ||
740 | |||
741 | /** | ||
742 | * fc_disc_init() - Initialize the discovery layer for a local port | ||
743 | * @lport: The local port that needs the discovery layer to be initialized | ||
744 | */ | ||
745 | void fc_disc_init(struct fc_lport *lport) | ||
746 | { | ||
747 | struct fc_disc *disc = &lport->disc; | ||
748 | |||
735 | INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); | 749 | INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); |
736 | mutex_init(&disc->disc_mutex); | 750 | mutex_init(&disc->disc_mutex); |
737 | INIT_LIST_HEAD(&disc->rports); | 751 | INIT_LIST_HEAD(&disc->rports); |
738 | |||
739 | disc->priv = lport; | ||
740 | |||
741 | return 0; | ||
742 | } | 752 | } |
743 | EXPORT_SYMBOL(fc_disc_init); | 753 | EXPORT_SYMBOL(fc_disc_init); |
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index aec2e0da5016..55cbd0180159 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -235,6 +235,17 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
235 | linkrate = phy->linkrate; | 235 | linkrate = phy->linkrate; |
236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); | 236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); |
237 | 237 | ||
238 | /* Handle vacant phy - rest of dr data is not valid so skip it */ | ||
239 | if (phy->phy_state == PHY_VACANT) { | ||
240 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
241 | phy->attached_dev_type = NO_DEVICE; | ||
242 | if (!test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) { | ||
243 | phy->phy_id = phy_id; | ||
244 | goto skip; | ||
245 | } else | ||
246 | goto out; | ||
247 | } | ||
248 | |||
238 | phy->attached_dev_type = to_dev_type(dr); | 249 | phy->attached_dev_type = to_dev_type(dr); |
239 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | 250 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) |
240 | goto out; | 251 | goto out; |
@@ -272,6 +283,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
272 | phy->phy->maximum_linkrate = dr->pmax_linkrate; | 283 | phy->phy->maximum_linkrate = dr->pmax_linkrate; |
273 | phy->phy->negotiated_linkrate = phy->linkrate; | 284 | phy->phy->negotiated_linkrate = phy->linkrate; |
274 | 285 | ||
286 | skip: | ||
275 | if (new_phy) | 287 | if (new_phy) |
276 | if (sas_phy_add(phy->phy)) { | 288 | if (sas_phy_add(phy->phy)) { |
277 | sas_phy_free(phy->phy); | 289 | sas_phy_free(phy->phy); |
@@ -388,7 +400,7 @@ int sas_ex_phy_discover(struct domain_device *dev, int single) | |||
388 | if (!disc_req) | 400 | if (!disc_req) |
389 | return -ENOMEM; | 401 | return -ENOMEM; |
390 | 402 | ||
391 | disc_resp = alloc_smp_req(DISCOVER_RESP_SIZE); | 403 | disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE); |
392 | if (!disc_resp) { | 404 | if (!disc_resp) { |
393 | kfree(disc_req); | 405 | kfree(disc_req); |
394 | return -ENOMEM; | 406 | return -ENOMEM; |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 74b67d98e952..d43faf34c1e2 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -438,11 +438,12 @@ lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq, | |||
438 | struct lpfc_rqe *temp_hrqe; | 438 | struct lpfc_rqe *temp_hrqe; |
439 | struct lpfc_rqe *temp_drqe; | 439 | struct lpfc_rqe *temp_drqe; |
440 | struct lpfc_register doorbell; | 440 | struct lpfc_register doorbell; |
441 | int put_index = hq->host_index; | 441 | int put_index; |
442 | 442 | ||
443 | /* sanity check on queue memory */ | 443 | /* sanity check on queue memory */ |
444 | if (unlikely(!hq) || unlikely(!dq)) | 444 | if (unlikely(!hq) || unlikely(!dq)) |
445 | return -ENOMEM; | 445 | return -ENOMEM; |
446 | put_index = hq->host_index; | ||
446 | temp_hrqe = hq->qe[hq->host_index].rqe; | 447 | temp_hrqe = hq->qe[hq->host_index].rqe; |
447 | temp_drqe = dq->qe[dq->host_index].rqe; | 448 | temp_drqe = dq->qe[dq->host_index].rqe; |
448 | 449 | ||
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 1d82eef4e1eb..b3db9dcc2619 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1938,11 +1938,6 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) | |||
1938 | "Timer for the VP[%d] has stopped\n", vha->vp_idx); | 1938 | "Timer for the VP[%d] has stopped\n", vha->vp_idx); |
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* No pending activities shall be there on the vha now */ | ||
1942 | if (ql2xextended_error_logging & ql_dbg_user) | ||
1943 | msleep(random32()%10); /* Just to see if something falls on | ||
1944 | * the net we have placed below */ | ||
1945 | |||
1946 | BUG_ON(atomic_read(&vha->vref_count)); | 1941 | BUG_ON(atomic_read(&vha->vref_count)); |
1947 | 1942 | ||
1948 | qla2x00_free_fcports(vha); | 1943 | qla2x00_free_fcports(vha); |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 1626de52e32a..fbc305f1c87c 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * | Mailbox commands | 0x115b | 0x111a-0x111b | | 15 | * | Mailbox commands | 0x115b | 0x111a-0x111b | |
16 | * | | | 0x112c-0x112e | | 16 | * | | | 0x112c-0x112e | |
17 | * | | | 0x113a | | 17 | * | | | 0x113a | |
18 | * | | | 0x1155-0x1158 | | ||
18 | * | Device Discovery | 0x2087 | 0x2020-0x2022, | | 19 | * | Device Discovery | 0x2087 | 0x2020-0x2022, | |
19 | * | | | 0x2016 | | 20 | * | | | 0x2016 | |
20 | * | Queue Command and IO tracing | 0x3031 | 0x3006-0x300b | | 21 | * | Queue Command and IO tracing | 0x3031 | 0x3006-0x300b | |
@@ -401,7 +402,7 @@ qla2xxx_copy_atioqueues(struct qla_hw_data *ha, void *ptr, | |||
401 | void *ring; | 402 | void *ring; |
402 | } aq, *aqp; | 403 | } aq, *aqp; |
403 | 404 | ||
404 | if (!ha->tgt.atio_q_length) | 405 | if (!ha->tgt.atio_ring) |
405 | return ptr; | 406 | return ptr; |
406 | 407 | ||
407 | num_queues = 1; | 408 | num_queues = 1; |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index c6509911772b..65c5ff75936b 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -863,7 +863,6 @@ typedef struct { | |||
863 | #define MBX_1 BIT_1 | 863 | #define MBX_1 BIT_1 |
864 | #define MBX_0 BIT_0 | 864 | #define MBX_0 BIT_0 |
865 | 865 | ||
866 | #define RNID_TYPE_SET_VERSION 0x9 | ||
867 | #define RNID_TYPE_ASIC_TEMP 0xC | 866 | #define RNID_TYPE_ASIC_TEMP 0xC |
868 | 867 | ||
869 | /* | 868 | /* |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index eb3ca21a7f17..b310fa97b545 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -358,9 +358,6 @@ extern int | |||
358 | qla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *); | 358 | qla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *); |
359 | 359 | ||
360 | extern int | 360 | extern int |
361 | qla2x00_set_driver_version(scsi_qla_host_t *, char *); | ||
362 | |||
363 | extern int | ||
364 | qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint8_t *, | 361 | qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint8_t *, |
365 | uint16_t, uint16_t, uint16_t, uint16_t); | 362 | uint16_t, uint16_t, uint16_t, uint16_t); |
366 | 363 | ||
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index edf4d14a1335..b59203393cb2 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -619,8 +619,6 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha) | |||
619 | if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)) | 619 | if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)) |
620 | qla24xx_read_fcp_prio_cfg(vha); | 620 | qla24xx_read_fcp_prio_cfg(vha); |
621 | 621 | ||
622 | qla2x00_set_driver_version(vha, QLA2XXX_VERSION); | ||
623 | |||
624 | return (rval); | 622 | return (rval); |
625 | } | 623 | } |
626 | 624 | ||
@@ -1399,7 +1397,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) | |||
1399 | mq_size += ha->max_rsp_queues * | 1397 | mq_size += ha->max_rsp_queues * |
1400 | (rsp->length * sizeof(response_t)); | 1398 | (rsp->length * sizeof(response_t)); |
1401 | } | 1399 | } |
1402 | if (ha->tgt.atio_q_length) | 1400 | if (ha->tgt.atio_ring) |
1403 | mq_size += ha->tgt.atio_q_length * sizeof(request_t); | 1401 | mq_size += ha->tgt.atio_q_length * sizeof(request_t); |
1404 | /* Allocate memory for Fibre Channel Event Buffer. */ | 1402 | /* Allocate memory for Fibre Channel Event Buffer. */ |
1405 | if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha) && !IS_QLA83XX(ha)) | 1403 | if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha) && !IS_QLA83XX(ha)) |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 186dd59ce4fa..43345af56431 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -3866,64 +3866,6 @@ qla81xx_restart_mpi_firmware(scsi_qla_host_t *vha) | |||
3866 | return rval; | 3866 | return rval; |
3867 | } | 3867 | } |
3868 | 3868 | ||
3869 | int | ||
3870 | qla2x00_set_driver_version(scsi_qla_host_t *vha, char *version) | ||
3871 | { | ||
3872 | int rval; | ||
3873 | mbx_cmd_t mc; | ||
3874 | mbx_cmd_t *mcp = &mc; | ||
3875 | int len; | ||
3876 | uint16_t dwlen; | ||
3877 | uint8_t *str; | ||
3878 | dma_addr_t str_dma; | ||
3879 | struct qla_hw_data *ha = vha->hw; | ||
3880 | |||
3881 | if (!IS_FWI2_CAPABLE(ha) || IS_QLA82XX(ha)) | ||
3882 | return QLA_FUNCTION_FAILED; | ||
3883 | |||
3884 | ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1155, | ||
3885 | "Entered %s.\n", __func__); | ||
3886 | |||
3887 | str = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &str_dma); | ||
3888 | if (!str) { | ||
3889 | ql_log(ql_log_warn, vha, 0x1156, | ||
3890 | "Failed to allocate driver version param.\n"); | ||
3891 | return QLA_MEMORY_ALLOC_FAILED; | ||
3892 | } | ||
3893 | |||
3894 | memcpy(str, "\x7\x3\x11\x0", 4); | ||
3895 | dwlen = str[0]; | ||
3896 | len = dwlen * sizeof(uint32_t) - 4; | ||
3897 | memset(str + 4, 0, len); | ||
3898 | if (len > strlen(version)) | ||
3899 | len = strlen(version); | ||
3900 | memcpy(str + 4, version, len); | ||
3901 | |||
3902 | mcp->mb[0] = MBC_SET_RNID_PARAMS; | ||
3903 | mcp->mb[1] = RNID_TYPE_SET_VERSION << 8 | dwlen; | ||
3904 | mcp->mb[2] = MSW(LSD(str_dma)); | ||
3905 | mcp->mb[3] = LSW(LSD(str_dma)); | ||
3906 | mcp->mb[6] = MSW(MSD(str_dma)); | ||
3907 | mcp->mb[7] = LSW(MSD(str_dma)); | ||
3908 | mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | ||
3909 | mcp->in_mb = MBX_0; | ||
3910 | mcp->tov = MBX_TOV_SECONDS; | ||
3911 | mcp->flags = 0; | ||
3912 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3913 | |||
3914 | if (rval != QLA_SUCCESS) { | ||
3915 | ql_dbg(ql_dbg_mbx, vha, 0x1157, | ||
3916 | "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); | ||
3917 | } else { | ||
3918 | ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1158, | ||
3919 | "Done %s.\n", __func__); | ||
3920 | } | ||
3921 | |||
3922 | dma_pool_free(ha->s_dma_pool, str, str_dma); | ||
3923 | |||
3924 | return rval; | ||
3925 | } | ||
3926 | |||
3927 | static int | 3869 | static int |
3928 | qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp) | 3870 | qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp) |
3929 | { | 3871 | { |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 2b6e478d9e33..ec54036d1e12 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.04.00.08-k" | 10 | #define QLA2XXX_VERSION "8.04.00.13-k" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 4 | 13 | #define QLA_DRIVER_MINOR_VER 4 |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 86974471af68..2a32036a9404 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4112,6 +4112,10 @@ static int st_probe(struct device *dev) | |||
4112 | tpnt->disk = disk; | 4112 | tpnt->disk = disk; |
4113 | disk->private_data = &tpnt->driver; | 4113 | disk->private_data = &tpnt->driver; |
4114 | disk->queue = SDp->request_queue; | 4114 | disk->queue = SDp->request_queue; |
4115 | /* SCSI tape doesn't register this gendisk via add_disk(). Manually | ||
4116 | * take queue reference that release_disk() expects. */ | ||
4117 | if (!blk_get_queue(disk->queue)) | ||
4118 | goto out_put_disk; | ||
4115 | tpnt->driver = &st_template; | 4119 | tpnt->driver = &st_template; |
4116 | 4120 | ||
4117 | tpnt->device = SDp; | 4121 | tpnt->device = SDp; |
@@ -4185,7 +4189,7 @@ static int st_probe(struct device *dev) | |||
4185 | idr_preload_end(); | 4189 | idr_preload_end(); |
4186 | if (error < 0) { | 4190 | if (error < 0) { |
4187 | pr_warn("st: idr allocation failed: %d\n", error); | 4191 | pr_warn("st: idr allocation failed: %d\n", error); |
4188 | goto out_put_disk; | 4192 | goto out_put_queue; |
4189 | } | 4193 | } |
4190 | tpnt->index = error; | 4194 | tpnt->index = error; |
4191 | sprintf(disk->disk_name, "st%d", tpnt->index); | 4195 | sprintf(disk->disk_name, "st%d", tpnt->index); |
@@ -4211,6 +4215,8 @@ out_remove_devs: | |||
4211 | spin_lock(&st_index_lock); | 4215 | spin_lock(&st_index_lock); |
4212 | idr_remove(&st_index_idr, tpnt->index); | 4216 | idr_remove(&st_index_idr, tpnt->index); |
4213 | spin_unlock(&st_index_lock); | 4217 | spin_unlock(&st_index_lock); |
4218 | out_put_queue: | ||
4219 | blk_put_queue(disk->queue); | ||
4214 | out_put_disk: | 4220 | out_put_disk: |
4215 | put_disk(disk); | 4221 | put_disk(disk); |
4216 | kfree(tpnt); | 4222 | kfree(tpnt); |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index f80eee74a311..2be0de920d67 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -55,6 +55,7 @@ comment "SPI Master Controller Drivers" | |||
55 | 55 | ||
56 | config SPI_ALTERA | 56 | config SPI_ALTERA |
57 | tristate "Altera SPI Controller" | 57 | tristate "Altera SPI Controller" |
58 | depends on GENERIC_HARDIRQS | ||
58 | select SPI_BITBANG | 59 | select SPI_BITBANG |
59 | help | 60 | help |
60 | This is the driver for the Altera SPI Controller. | 61 | This is the driver for the Altera SPI Controller. |
@@ -310,7 +311,7 @@ config SPI_PXA2XX_DMA | |||
310 | 311 | ||
311 | config SPI_PXA2XX | 312 | config SPI_PXA2XX |
312 | tristate "PXA2xx SSP SPI master" | 313 | tristate "PXA2xx SSP SPI master" |
313 | depends on ARCH_PXA || PCI || ACPI | 314 | depends on (ARCH_PXA || PCI || ACPI) && GENERIC_HARDIRQS |
314 | select PXA_SSP if ARCH_PXA | 315 | select PXA_SSP if ARCH_PXA |
315 | help | 316 | help |
316 | This enables using a PXA2xx or Sodaville SSP port as a SPI master | 317 | This enables using a PXA2xx or Sodaville SSP port as a SPI master |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 9578af782a77..d7df435d962e 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -152,7 +152,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi, | |||
152 | static int bcm63xx_spi_setup(struct spi_device *spi) | 152 | static int bcm63xx_spi_setup(struct spi_device *spi) |
153 | { | 153 | { |
154 | struct bcm63xx_spi *bs; | 154 | struct bcm63xx_spi *bs; |
155 | int ret; | ||
156 | 155 | ||
157 | bs = spi_master_get_devdata(spi->master); | 156 | bs = spi_master_get_devdata(spi->master); |
158 | 157 | ||
@@ -490,7 +489,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) | |||
490 | default: | 489 | default: |
491 | dev_err(dev, "unsupported MSG_CTL width: %d\n", | 490 | dev_err(dev, "unsupported MSG_CTL width: %d\n", |
492 | bs->msg_ctl_width); | 491 | bs->msg_ctl_width); |
493 | goto out_clk_disable; | 492 | goto out_err; |
494 | } | 493 | } |
495 | 494 | ||
496 | /* Initialize hardware */ | 495 | /* Initialize hardware */ |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 89480b281d74..3e490ee7f275 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -164,7 +164,7 @@ static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
164 | 164 | ||
165 | for (i = count; i > 0; i--) { | 165 | for (i = count; i > 0; i--) { |
166 | data = tx_buf ? *tx_buf++ : 0; | 166 | data = tx_buf ? *tx_buf++ : 0; |
167 | if (len == EOFBYTE) | 167 | if (len == EOFBYTE && t->cs_change) |
168 | setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF); | 168 | setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF); |
169 | out_8(&fifo->txdata_8, data); | 169 | out_8(&fifo->txdata_8, data); |
170 | len--; | 170 | len--; |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 90b27a3508a6..810413883c79 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1168,7 +1168,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) | |||
1168 | 1168 | ||
1169 | master->dev.parent = &pdev->dev; | 1169 | master->dev.parent = &pdev->dev; |
1170 | master->dev.of_node = pdev->dev.of_node; | 1170 | master->dev.of_node = pdev->dev.of_node; |
1171 | ACPI_HANDLE_SET(&master->dev, ACPI_HANDLE(&pdev->dev)); | ||
1172 | /* the spi->mode bits understood by this driver: */ | 1171 | /* the spi->mode bits understood by this driver: */ |
1173 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 1172 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
1174 | 1173 | ||
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index e862ab8853aa..4188b2faac5c 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -994,25 +994,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data) | |||
994 | { | 994 | { |
995 | struct s3c64xx_spi_driver_data *sdd = data; | 995 | struct s3c64xx_spi_driver_data *sdd = data; |
996 | struct spi_master *spi = sdd->master; | 996 | struct spi_master *spi = sdd->master; |
997 | unsigned int val; | 997 | unsigned int val, clr = 0; |
998 | 998 | ||
999 | val = readl(sdd->regs + S3C64XX_SPI_PENDING_CLR); | 999 | val = readl(sdd->regs + S3C64XX_SPI_STATUS); |
1000 | 1000 | ||
1001 | val &= S3C64XX_SPI_PND_RX_OVERRUN_CLR | | 1001 | if (val & S3C64XX_SPI_ST_RX_OVERRUN_ERR) { |
1002 | S3C64XX_SPI_PND_RX_UNDERRUN_CLR | | 1002 | clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR; |
1003 | S3C64XX_SPI_PND_TX_OVERRUN_CLR | | ||
1004 | S3C64XX_SPI_PND_TX_UNDERRUN_CLR; | ||
1005 | |||
1006 | writel(val, sdd->regs + S3C64XX_SPI_PENDING_CLR); | ||
1007 | |||
1008 | if (val & S3C64XX_SPI_PND_RX_OVERRUN_CLR) | ||
1009 | dev_err(&spi->dev, "RX overrun\n"); | 1003 | dev_err(&spi->dev, "RX overrun\n"); |
1010 | if (val & S3C64XX_SPI_PND_RX_UNDERRUN_CLR) | 1004 | } |
1005 | if (val & S3C64XX_SPI_ST_RX_UNDERRUN_ERR) { | ||
1006 | clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR; | ||
1011 | dev_err(&spi->dev, "RX underrun\n"); | 1007 | dev_err(&spi->dev, "RX underrun\n"); |
1012 | if (val & S3C64XX_SPI_PND_TX_OVERRUN_CLR) | 1008 | } |
1009 | if (val & S3C64XX_SPI_ST_TX_OVERRUN_ERR) { | ||
1010 | clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR; | ||
1013 | dev_err(&spi->dev, "TX overrun\n"); | 1011 | dev_err(&spi->dev, "TX overrun\n"); |
1014 | if (val & S3C64XX_SPI_PND_TX_UNDERRUN_CLR) | 1012 | } |
1013 | if (val & S3C64XX_SPI_ST_TX_UNDERRUN_ERR) { | ||
1014 | clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR; | ||
1015 | dev_err(&spi->dev, "TX underrun\n"); | 1015 | dev_err(&spi->dev, "TX underrun\n"); |
1016 | } | ||
1017 | |||
1018 | /* Clear the pending irq by setting and then clearing it */ | ||
1019 | writel(clr, sdd->regs + S3C64XX_SPI_PENDING_CLR); | ||
1020 | writel(0, sdd->regs + S3C64XX_SPI_PENDING_CLR); | ||
1016 | 1021 | ||
1017 | return IRQ_HANDLED; | 1022 | return IRQ_HANDLED; |
1018 | } | 1023 | } |
@@ -1036,9 +1041,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel) | |||
1036 | writel(0, regs + S3C64XX_SPI_MODE_CFG); | 1041 | writel(0, regs + S3C64XX_SPI_MODE_CFG); |
1037 | writel(0, regs + S3C64XX_SPI_PACKET_CNT); | 1042 | writel(0, regs + S3C64XX_SPI_PACKET_CNT); |
1038 | 1043 | ||
1039 | /* Clear any irq pending bits */ | 1044 | /* Clear any irq pending bits, should set and clear the bits */ |
1040 | writel(readl(regs + S3C64XX_SPI_PENDING_CLR), | 1045 | val = S3C64XX_SPI_PND_RX_OVERRUN_CLR | |
1041 | regs + S3C64XX_SPI_PENDING_CLR); | 1046 | S3C64XX_SPI_PND_RX_UNDERRUN_CLR | |
1047 | S3C64XX_SPI_PND_TX_OVERRUN_CLR | | ||
1048 | S3C64XX_SPI_PND_TX_UNDERRUN_CLR; | ||
1049 | writel(val, regs + S3C64XX_SPI_PENDING_CLR); | ||
1050 | writel(0, regs + S3C64XX_SPI_PENDING_CLR); | ||
1042 | 1051 | ||
1043 | writel(0, regs + S3C64XX_SPI_SWAP_CFG); | 1052 | writel(0, regs + S3C64XX_SPI_SWAP_CFG); |
1044 | 1053 | ||
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index b8698b389ef3..a829563f4713 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
@@ -858,21 +858,6 @@ static int tegra_slink_setup(struct spi_device *spi) | |||
858 | return 0; | 858 | return 0; |
859 | } | 859 | } |
860 | 860 | ||
861 | static int tegra_slink_prepare_transfer(struct spi_master *master) | ||
862 | { | ||
863 | struct tegra_slink_data *tspi = spi_master_get_devdata(master); | ||
864 | |||
865 | return pm_runtime_get_sync(tspi->dev); | ||
866 | } | ||
867 | |||
868 | static int tegra_slink_unprepare_transfer(struct spi_master *master) | ||
869 | { | ||
870 | struct tegra_slink_data *tspi = spi_master_get_devdata(master); | ||
871 | |||
872 | pm_runtime_put(tspi->dev); | ||
873 | return 0; | ||
874 | } | ||
875 | |||
876 | static int tegra_slink_transfer_one_message(struct spi_master *master, | 861 | static int tegra_slink_transfer_one_message(struct spi_master *master, |
877 | struct spi_message *msg) | 862 | struct spi_message *msg) |
878 | { | 863 | { |
@@ -885,6 +870,12 @@ static int tegra_slink_transfer_one_message(struct spi_master *master, | |||
885 | 870 | ||
886 | msg->status = 0; | 871 | msg->status = 0; |
887 | msg->actual_length = 0; | 872 | msg->actual_length = 0; |
873 | ret = pm_runtime_get_sync(tspi->dev); | ||
874 | if (ret < 0) { | ||
875 | dev_err(tspi->dev, "runtime get failed: %d\n", ret); | ||
876 | goto done; | ||
877 | } | ||
878 | |||
888 | single_xfer = list_is_singular(&msg->transfers); | 879 | single_xfer = list_is_singular(&msg->transfers); |
889 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 880 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
890 | INIT_COMPLETION(tspi->xfer_completion); | 881 | INIT_COMPLETION(tspi->xfer_completion); |
@@ -921,6 +912,8 @@ static int tegra_slink_transfer_one_message(struct spi_master *master, | |||
921 | exit: | 912 | exit: |
922 | tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); | 913 | tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); |
923 | tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); | 914 | tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); |
915 | pm_runtime_put(tspi->dev); | ||
916 | done: | ||
924 | msg->status = ret; | 917 | msg->status = ret; |
925 | spi_finalize_current_message(master); | 918 | spi_finalize_current_message(master); |
926 | return ret; | 919 | return ret; |
@@ -1148,9 +1141,7 @@ static int tegra_slink_probe(struct platform_device *pdev) | |||
1148 | /* the spi->mode bits understood by this driver: */ | 1141 | /* the spi->mode bits understood by this driver: */ |
1149 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; | 1142 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; |
1150 | master->setup = tegra_slink_setup; | 1143 | master->setup = tegra_slink_setup; |
1151 | master->prepare_transfer_hardware = tegra_slink_prepare_transfer; | ||
1152 | master->transfer_one_message = tegra_slink_transfer_one_message; | 1144 | master->transfer_one_message = tegra_slink_transfer_one_message; |
1153 | master->unprepare_transfer_hardware = tegra_slink_unprepare_transfer; | ||
1154 | master->num_chipselect = MAX_CHIP_SELECT; | 1145 | master->num_chipselect = MAX_CHIP_SELECT; |
1155 | master->bus_num = -1; | 1146 | master->bus_num = -1; |
1156 | 1147 | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index f996c600eb8c..004b10f184d4 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -543,17 +543,16 @@ static void spi_pump_messages(struct kthread_work *work) | |||
543 | /* Lock queue and check for queue work */ | 543 | /* Lock queue and check for queue work */ |
544 | spin_lock_irqsave(&master->queue_lock, flags); | 544 | spin_lock_irqsave(&master->queue_lock, flags); |
545 | if (list_empty(&master->queue) || !master->running) { | 545 | if (list_empty(&master->queue) || !master->running) { |
546 | if (master->busy && master->unprepare_transfer_hardware) { | 546 | if (!master->busy) { |
547 | ret = master->unprepare_transfer_hardware(master); | 547 | spin_unlock_irqrestore(&master->queue_lock, flags); |
548 | if (ret) { | 548 | return; |
549 | spin_unlock_irqrestore(&master->queue_lock, flags); | ||
550 | dev_err(&master->dev, | ||
551 | "failed to unprepare transfer hardware\n"); | ||
552 | return; | ||
553 | } | ||
554 | } | 549 | } |
555 | master->busy = false; | 550 | master->busy = false; |
556 | spin_unlock_irqrestore(&master->queue_lock, flags); | 551 | spin_unlock_irqrestore(&master->queue_lock, flags); |
552 | if (master->unprepare_transfer_hardware && | ||
553 | master->unprepare_transfer_hardware(master)) | ||
554 | dev_err(&master->dev, | ||
555 | "failed to unprepare transfer hardware\n"); | ||
557 | return; | 556 | return; |
558 | } | 557 | } |
559 | 558 | ||
@@ -984,7 +983,7 @@ static void acpi_register_spi_devices(struct spi_master *master) | |||
984 | acpi_status status; | 983 | acpi_status status; |
985 | acpi_handle handle; | 984 | acpi_handle handle; |
986 | 985 | ||
987 | handle = ACPI_HANDLE(&master->dev); | 986 | handle = ACPI_HANDLE(master->dev.parent); |
988 | if (!handle) | 987 | if (!handle) |
989 | return; | 988 | return; |
990 | 989 | ||
diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c index 4c0f6d883dd3..7b0bce936762 100644 --- a/drivers/ssb/driver_chipcommon_pmu.c +++ b/drivers/ssb/driver_chipcommon_pmu.c | |||
@@ -675,3 +675,32 @@ u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc) | |||
675 | return 0; | 675 | return 0; |
676 | } | 676 | } |
677 | } | 677 | } |
678 | |||
679 | void ssb_pmu_spuravoid_pllupdate(struct ssb_chipcommon *cc, int spuravoid) | ||
680 | { | ||
681 | u32 pmu_ctl = 0; | ||
682 | |||
683 | switch (cc->dev->bus->chip_id) { | ||
684 | case 0x4322: | ||
685 | ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, 0x11100070); | ||
686 | ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL1, 0x1014140a); | ||
687 | ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, 0x88888854); | ||
688 | if (spuravoid == 1) | ||
689 | ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, 0x05201828); | ||
690 | else | ||
691 | ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, 0x05001828); | ||
692 | pmu_ctl = SSB_CHIPCO_PMU_CTL_PLL_UPD; | ||
693 | break; | ||
694 | case 43222: | ||
695 | /* TODO: BCM43222 requires updating PLLs too */ | ||
696 | return; | ||
697 | default: | ||
698 | ssb_printk(KERN_ERR PFX | ||
699 | "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n", | ||
700 | cc->dev->bus->chip_id); | ||
701 | return; | ||
702 | } | ||
703 | |||
704 | chipco_set32(cc, SSB_CHIPCO_PMU_CTL, pmu_ctl); | ||
705 | } | ||
706 | EXPORT_SYMBOL_GPL(ssb_pmu_spuravoid_pllupdate); | ||
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index 192cf088f834..57b451904791 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c | |||
@@ -947,12 +947,13 @@ static int dt9812_di_rinsn(struct comedi_device *dev, | |||
947 | unsigned int *data) | 947 | unsigned int *data) |
948 | { | 948 | { |
949 | struct comedi_dt9812 *devpriv = dev->private; | 949 | struct comedi_dt9812 *devpriv = dev->private; |
950 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
950 | int n; | 951 | int n; |
951 | u8 bits = 0; | 952 | u8 bits = 0; |
952 | 953 | ||
953 | dt9812_digital_in(devpriv->slot, &bits); | 954 | dt9812_digital_in(devpriv->slot, &bits); |
954 | for (n = 0; n < insn->n; n++) | 955 | for (n = 0; n < insn->n; n++) |
955 | data[n] = ((1 << insn->chanspec) & bits) != 0; | 956 | data[n] = ((1 << channel) & bits) != 0; |
956 | return n; | 957 | return n; |
957 | } | 958 | } |
958 | 959 | ||
@@ -961,12 +962,13 @@ static int dt9812_do_winsn(struct comedi_device *dev, | |||
961 | unsigned int *data) | 962 | unsigned int *data) |
962 | { | 963 | { |
963 | struct comedi_dt9812 *devpriv = dev->private; | 964 | struct comedi_dt9812 *devpriv = dev->private; |
965 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
964 | int n; | 966 | int n; |
965 | u8 bits = 0; | 967 | u8 bits = 0; |
966 | 968 | ||
967 | dt9812_digital_out_shadow(devpriv->slot, &bits); | 969 | dt9812_digital_out_shadow(devpriv->slot, &bits); |
968 | for (n = 0; n < insn->n; n++) { | 970 | for (n = 0; n < insn->n; n++) { |
969 | u8 mask = 1 << insn->chanspec; | 971 | u8 mask = 1 << channel; |
970 | 972 | ||
971 | bits &= ~mask; | 973 | bits &= ~mask; |
972 | if (data[n]) | 974 | if (data[n]) |
@@ -981,13 +983,13 @@ static int dt9812_ai_rinsn(struct comedi_device *dev, | |||
981 | unsigned int *data) | 983 | unsigned int *data) |
982 | { | 984 | { |
983 | struct comedi_dt9812 *devpriv = dev->private; | 985 | struct comedi_dt9812 *devpriv = dev->private; |
986 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
984 | int n; | 987 | int n; |
985 | 988 | ||
986 | for (n = 0; n < insn->n; n++) { | 989 | for (n = 0; n < insn->n; n++) { |
987 | u16 value = 0; | 990 | u16 value = 0; |
988 | 991 | ||
989 | dt9812_analog_in(devpriv->slot, insn->chanspec, &value, | 992 | dt9812_analog_in(devpriv->slot, channel, &value, DT9812_GAIN_1); |
990 | DT9812_GAIN_1); | ||
991 | data[n] = value; | 993 | data[n] = value; |
992 | } | 994 | } |
993 | return n; | 995 | return n; |
@@ -998,12 +1000,13 @@ static int dt9812_ao_rinsn(struct comedi_device *dev, | |||
998 | unsigned int *data) | 1000 | unsigned int *data) |
999 | { | 1001 | { |
1000 | struct comedi_dt9812 *devpriv = dev->private; | 1002 | struct comedi_dt9812 *devpriv = dev->private; |
1003 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
1001 | int n; | 1004 | int n; |
1002 | u16 value; | 1005 | u16 value; |
1003 | 1006 | ||
1004 | for (n = 0; n < insn->n; n++) { | 1007 | for (n = 0; n < insn->n; n++) { |
1005 | value = 0; | 1008 | value = 0; |
1006 | dt9812_analog_out_shadow(devpriv->slot, insn->chanspec, &value); | 1009 | dt9812_analog_out_shadow(devpriv->slot, channel, &value); |
1007 | data[n] = value; | 1010 | data[n] = value; |
1008 | } | 1011 | } |
1009 | return n; | 1012 | return n; |
@@ -1014,10 +1017,11 @@ static int dt9812_ao_winsn(struct comedi_device *dev, | |||
1014 | unsigned int *data) | 1017 | unsigned int *data) |
1015 | { | 1018 | { |
1016 | struct comedi_dt9812 *devpriv = dev->private; | 1019 | struct comedi_dt9812 *devpriv = dev->private; |
1020 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
1017 | int n; | 1021 | int n; |
1018 | 1022 | ||
1019 | for (n = 0; n < insn->n; n++) | 1023 | for (n = 0; n < insn->n; n++) |
1020 | dt9812_analog_out(devpriv->slot, insn->chanspec, data[n]); | 1024 | dt9812_analog_out(devpriv->slot, channel, data[n]); |
1021 | return n; | 1025 | return n; |
1022 | } | 1026 | } |
1023 | 1027 | ||
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 81a1fe661579..71a73ec5af8d 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c | |||
@@ -1483,7 +1483,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) | |||
1483 | case TRIG_NONE: | 1483 | case TRIG_NONE: |
1484 | /* continous acquisition */ | 1484 | /* continous acquisition */ |
1485 | devpriv->ai_continous = 1; | 1485 | devpriv->ai_continous = 1; |
1486 | devpriv->ai_sample_count = 0; | 1486 | devpriv->ai_sample_count = 1; |
1487 | break; | 1487 | break; |
1488 | } | 1488 | } |
1489 | 1489 | ||
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 1a0062a04456..6aac1f60bc42 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c | |||
@@ -730,10 +730,14 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
730 | static int usbduxsub_start(struct usbduxsub *usbduxsub) | 730 | static int usbduxsub_start(struct usbduxsub *usbduxsub) |
731 | { | 731 | { |
732 | int errcode = 0; | 732 | int errcode = 0; |
733 | uint8_t local_transfer_buffer[16]; | 733 | uint8_t *local_transfer_buffer; |
734 | |||
735 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); | ||
736 | if (!local_transfer_buffer) | ||
737 | return -ENOMEM; | ||
734 | 738 | ||
735 | /* 7f92 to zero */ | 739 | /* 7f92 to zero */ |
736 | local_transfer_buffer[0] = 0; | 740 | *local_transfer_buffer = 0; |
737 | errcode = usb_control_msg(usbduxsub->usbdev, | 741 | errcode = usb_control_msg(usbduxsub->usbdev, |
738 | /* create a pipe for a control transfer */ | 742 | /* create a pipe for a control transfer */ |
739 | usb_sndctrlpipe(usbduxsub->usbdev, 0), | 743 | usb_sndctrlpipe(usbduxsub->usbdev, 0), |
@@ -751,22 +755,25 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub) | |||
751 | 1, | 755 | 1, |
752 | /* Timeout */ | 756 | /* Timeout */ |
753 | BULK_TIMEOUT); | 757 | BULK_TIMEOUT); |
754 | if (errcode < 0) { | 758 | if (errcode < 0) |
755 | dev_err(&usbduxsub->interface->dev, | 759 | dev_err(&usbduxsub->interface->dev, |
756 | "comedi_: control msg failed (start)\n"); | 760 | "comedi_: control msg failed (start)\n"); |
757 | return errcode; | 761 | |
758 | } | 762 | kfree(local_transfer_buffer); |
759 | return 0; | 763 | return errcode; |
760 | } | 764 | } |
761 | 765 | ||
762 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) | 766 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) |
763 | { | 767 | { |
764 | int errcode = 0; | 768 | int errcode = 0; |
769 | uint8_t *local_transfer_buffer; | ||
765 | 770 | ||
766 | uint8_t local_transfer_buffer[16]; | 771 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); |
772 | if (!local_transfer_buffer) | ||
773 | return -ENOMEM; | ||
767 | 774 | ||
768 | /* 7f92 to one */ | 775 | /* 7f92 to one */ |
769 | local_transfer_buffer[0] = 1; | 776 | *local_transfer_buffer = 1; |
770 | errcode = usb_control_msg(usbduxsub->usbdev, | 777 | errcode = usb_control_msg(usbduxsub->usbdev, |
771 | usb_sndctrlpipe(usbduxsub->usbdev, 0), | 778 | usb_sndctrlpipe(usbduxsub->usbdev, 0), |
772 | /* bRequest, "Firmware" */ | 779 | /* bRequest, "Firmware" */ |
@@ -781,12 +788,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) | |||
781 | 1, | 788 | 1, |
782 | /* Timeout */ | 789 | /* Timeout */ |
783 | BULK_TIMEOUT); | 790 | BULK_TIMEOUT); |
784 | if (errcode < 0) { | 791 | if (errcode < 0) |
785 | dev_err(&usbduxsub->interface->dev, | 792 | dev_err(&usbduxsub->interface->dev, |
786 | "comedi_: control msg failed (stop)\n"); | 793 | "comedi_: control msg failed (stop)\n"); |
787 | return errcode; | 794 | |
788 | } | 795 | kfree(local_transfer_buffer); |
789 | return 0; | 796 | return errcode; |
790 | } | 797 | } |
791 | 798 | ||
792 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, | 799 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, |
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 4bf5dd094dc9..1ba0e3df492d 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c | |||
@@ -436,10 +436,14 @@ static void usbduxfastsub_ai_Irq(struct urb *urb) | |||
436 | static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) | 436 | static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) |
437 | { | 437 | { |
438 | int ret; | 438 | int ret; |
439 | unsigned char local_transfer_buffer[16]; | 439 | unsigned char *local_transfer_buffer; |
440 | |||
441 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); | ||
442 | if (!local_transfer_buffer) | ||
443 | return -ENOMEM; | ||
440 | 444 | ||
441 | /* 7f92 to zero */ | 445 | /* 7f92 to zero */ |
442 | local_transfer_buffer[0] = 0; | 446 | *local_transfer_buffer = 0; |
443 | /* bRequest, "Firmware" */ | 447 | /* bRequest, "Firmware" */ |
444 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), | 448 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), |
445 | USBDUXFASTSUB_FIRMWARE, | 449 | USBDUXFASTSUB_FIRMWARE, |
@@ -450,22 +454,25 @@ static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) | |||
450 | local_transfer_buffer, | 454 | local_transfer_buffer, |
451 | 1, /* Length */ | 455 | 1, /* Length */ |
452 | EZTIMEOUT); /* Timeout */ | 456 | EZTIMEOUT); /* Timeout */ |
453 | if (ret < 0) { | 457 | if (ret < 0) |
454 | dev_err(&udfs->interface->dev, | 458 | dev_err(&udfs->interface->dev, |
455 | "control msg failed (start)\n"); | 459 | "control msg failed (start)\n"); |
456 | return ret; | ||
457 | } | ||
458 | 460 | ||
459 | return 0; | 461 | kfree(local_transfer_buffer); |
462 | return ret; | ||
460 | } | 463 | } |
461 | 464 | ||
462 | static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) | 465 | static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) |
463 | { | 466 | { |
464 | int ret; | 467 | int ret; |
465 | unsigned char local_transfer_buffer[16]; | 468 | unsigned char *local_transfer_buffer; |
469 | |||
470 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); | ||
471 | if (!local_transfer_buffer) | ||
472 | return -ENOMEM; | ||
466 | 473 | ||
467 | /* 7f92 to one */ | 474 | /* 7f92 to one */ |
468 | local_transfer_buffer[0] = 1; | 475 | *local_transfer_buffer = 1; |
469 | /* bRequest, "Firmware" */ | 476 | /* bRequest, "Firmware" */ |
470 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), | 477 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), |
471 | USBDUXFASTSUB_FIRMWARE, | 478 | USBDUXFASTSUB_FIRMWARE, |
@@ -474,13 +481,12 @@ static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) | |||
474 | 0x0000, /* Index */ | 481 | 0x0000, /* Index */ |
475 | local_transfer_buffer, 1, /* Length */ | 482 | local_transfer_buffer, 1, /* Length */ |
476 | EZTIMEOUT); /* Timeout */ | 483 | EZTIMEOUT); /* Timeout */ |
477 | if (ret < 0) { | 484 | if (ret < 0) |
478 | dev_err(&udfs->interface->dev, | 485 | dev_err(&udfs->interface->dev, |
479 | "control msg failed (stop)\n"); | 486 | "control msg failed (stop)\n"); |
480 | return ret; | ||
481 | } | ||
482 | 487 | ||
483 | return 0; | 488 | kfree(local_transfer_buffer); |
489 | return ret; | ||
484 | } | 490 | } |
485 | 491 | ||
486 | static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, | 492 | static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, |
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index d066351a71b2..a728c8fc32a2 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c | |||
@@ -681,7 +681,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
681 | static int usbduxsub_start(struct usbduxsub *usbduxsub) | 681 | static int usbduxsub_start(struct usbduxsub *usbduxsub) |
682 | { | 682 | { |
683 | int errcode = 0; | 683 | int errcode = 0; |
684 | uint8_t local_transfer_buffer[16]; | 684 | uint8_t *local_transfer_buffer; |
685 | |||
686 | local_transfer_buffer = kmalloc(16, GFP_KERNEL); | ||
687 | if (!local_transfer_buffer) | ||
688 | return -ENOMEM; | ||
685 | 689 | ||
686 | /* 7f92 to zero */ | 690 | /* 7f92 to zero */ |
687 | local_transfer_buffer[0] = 0; | 691 | local_transfer_buffer[0] = 0; |
@@ -702,19 +706,22 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub) | |||
702 | 1, | 706 | 1, |
703 | /* Timeout */ | 707 | /* Timeout */ |
704 | BULK_TIMEOUT); | 708 | BULK_TIMEOUT); |
705 | if (errcode < 0) { | 709 | if (errcode < 0) |
706 | dev_err(&usbduxsub->interface->dev, | 710 | dev_err(&usbduxsub->interface->dev, |
707 | "comedi_: control msg failed (start)\n"); | 711 | "comedi_: control msg failed (start)\n"); |
708 | return errcode; | 712 | |
709 | } | 713 | kfree(local_transfer_buffer); |
710 | return 0; | 714 | return errcode; |
711 | } | 715 | } |
712 | 716 | ||
713 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) | 717 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) |
714 | { | 718 | { |
715 | int errcode = 0; | 719 | int errcode = 0; |
720 | uint8_t *local_transfer_buffer; | ||
716 | 721 | ||
717 | uint8_t local_transfer_buffer[16]; | 722 | local_transfer_buffer = kmalloc(16, GFP_KERNEL); |
723 | if (!local_transfer_buffer) | ||
724 | return -ENOMEM; | ||
718 | 725 | ||
719 | /* 7f92 to one */ | 726 | /* 7f92 to one */ |
720 | local_transfer_buffer[0] = 1; | 727 | local_transfer_buffer[0] = 1; |
@@ -732,12 +739,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) | |||
732 | 1, | 739 | 1, |
733 | /* Timeout */ | 740 | /* Timeout */ |
734 | BULK_TIMEOUT); | 741 | BULK_TIMEOUT); |
735 | if (errcode < 0) { | 742 | if (errcode < 0) |
736 | dev_err(&usbduxsub->interface->dev, | 743 | dev_err(&usbduxsub->interface->dev, |
737 | "comedi_: control msg failed (stop)\n"); | 744 | "comedi_: control msg failed (stop)\n"); |
738 | return errcode; | 745 | |
739 | } | 746 | kfree(local_transfer_buffer); |
740 | return 0; | 747 | return errcode; |
741 | } | 748 | } |
742 | 749 | ||
743 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, | 750 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, |
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 4b3a019409b5..b028b0d1317b 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c | |||
@@ -483,17 +483,6 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc, | |||
483 | goto err_out; | 483 | goto err_out; |
484 | } | 484 | } |
485 | 485 | ||
486 | ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch, | ||
487 | IPU_IRQ_EOF); | ||
488 | ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0, | ||
489 | "imx_drm", ipu_crtc); | ||
490 | if (ret < 0) { | ||
491 | dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret); | ||
492 | goto err_out; | ||
493 | } | ||
494 | |||
495 | disable_irq(ipu_crtc->irq); | ||
496 | |||
497 | return 0; | 486 | return 0; |
498 | err_out: | 487 | err_out: |
499 | ipu_put_resources(ipu_crtc); | 488 | ipu_put_resources(ipu_crtc); |
@@ -504,6 +493,7 @@ err_out: | |||
504 | static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, | 493 | static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, |
505 | struct ipu_client_platformdata *pdata) | 494 | struct ipu_client_platformdata *pdata) |
506 | { | 495 | { |
496 | struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent); | ||
507 | int ret; | 497 | int ret; |
508 | 498 | ||
509 | ret = ipu_get_resources(ipu_crtc, pdata); | 499 | ret = ipu_get_resources(ipu_crtc, pdata); |
@@ -522,6 +512,17 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, | |||
522 | goto err_put_resources; | 512 | goto err_put_resources; |
523 | } | 513 | } |
524 | 514 | ||
515 | ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch, | ||
516 | IPU_IRQ_EOF); | ||
517 | ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0, | ||
518 | "imx_drm", ipu_crtc); | ||
519 | if (ret < 0) { | ||
520 | dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret); | ||
521 | goto err_put_resources; | ||
522 | } | ||
523 | |||
524 | disable_irq(ipu_crtc->irq); | ||
525 | |||
525 | return 0; | 526 | return 0; |
526 | 527 | ||
527 | err_put_resources: | 528 | err_put_resources: |
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index db1da28cecba..be26917a6896 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c | |||
@@ -76,37 +76,28 @@ int drv_insert_node_res_element(void *hnode, void *node_resource, | |||
76 | struct node_res_object **node_res_obj = | 76 | struct node_res_object **node_res_obj = |
77 | (struct node_res_object **)node_resource; | 77 | (struct node_res_object **)node_resource; |
78 | struct process_context *ctxt = (struct process_context *)process_ctxt; | 78 | struct process_context *ctxt = (struct process_context *)process_ctxt; |
79 | int status = 0; | ||
80 | int retval; | 79 | int retval; |
81 | 80 | ||
82 | *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL); | 81 | *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL); |
83 | if (!*node_res_obj) { | 82 | if (!*node_res_obj) |
84 | status = -ENOMEM; | 83 | return -ENOMEM; |
85 | goto func_end; | ||
86 | } | ||
87 | 84 | ||
88 | (*node_res_obj)->node = hnode; | 85 | (*node_res_obj)->node = hnode; |
89 | retval = idr_get_new(ctxt->node_id, *node_res_obj, | 86 | retval = idr_alloc(ctxt->node_id, *node_res_obj, 0, 0, GFP_KERNEL); |
90 | &(*node_res_obj)->id); | 87 | if (retval >= 0) { |
91 | if (retval == -EAGAIN) { | 88 | (*node_res_obj)->id = retval; |
92 | if (!idr_pre_get(ctxt->node_id, GFP_KERNEL)) { | 89 | return 0; |
93 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
94 | status = -ENOMEM; | ||
95 | goto func_end; | ||
96 | } | ||
97 | |||
98 | retval = idr_get_new(ctxt->node_id, *node_res_obj, | ||
99 | &(*node_res_obj)->id); | ||
100 | } | 90 | } |
101 | if (retval) { | 91 | |
92 | kfree(*node_res_obj); | ||
93 | |||
94 | if (retval == -ENOSPC) { | ||
102 | pr_err("%s: FAILED, IDR is FULL\n", __func__); | 95 | pr_err("%s: FAILED, IDR is FULL\n", __func__); |
103 | status = -EFAULT; | 96 | return -EFAULT; |
97 | } else { | ||
98 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
99 | return -ENOMEM; | ||
104 | } | 100 | } |
105 | func_end: | ||
106 | if (status) | ||
107 | kfree(*node_res_obj); | ||
108 | |||
109 | return status; | ||
110 | } | 101 | } |
111 | 102 | ||
112 | /* Release all Node resources and its context | 103 | /* Release all Node resources and its context |
@@ -201,35 +192,26 @@ int drv_proc_insert_strm_res_element(void *stream_obj, | |||
201 | struct strm_res_object **pstrm_res = | 192 | struct strm_res_object **pstrm_res = |
202 | (struct strm_res_object **)strm_res; | 193 | (struct strm_res_object **)strm_res; |
203 | struct process_context *ctxt = (struct process_context *)process_ctxt; | 194 | struct process_context *ctxt = (struct process_context *)process_ctxt; |
204 | int status = 0; | ||
205 | int retval; | 195 | int retval; |
206 | 196 | ||
207 | *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL); | 197 | *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL); |
208 | if (*pstrm_res == NULL) { | 198 | if (*pstrm_res == NULL) |
209 | status = -EFAULT; | 199 | return -EFAULT; |
210 | goto func_end; | ||
211 | } | ||
212 | 200 | ||
213 | (*pstrm_res)->stream = stream_obj; | 201 | (*pstrm_res)->stream = stream_obj; |
214 | retval = idr_get_new(ctxt->stream_id, *pstrm_res, | 202 | retval = idr_alloc(ctxt->stream_id, *pstrm_res, 0, 0, GFP_KERNEL); |
215 | &(*pstrm_res)->id); | 203 | if (retval >= 0) { |
216 | if (retval == -EAGAIN) { | 204 | (*pstrm_res)->id = retval; |
217 | if (!idr_pre_get(ctxt->stream_id, GFP_KERNEL)) { | 205 | return 0; |
218 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
219 | status = -ENOMEM; | ||
220 | goto func_end; | ||
221 | } | ||
222 | |||
223 | retval = idr_get_new(ctxt->stream_id, *pstrm_res, | ||
224 | &(*pstrm_res)->id); | ||
225 | } | 206 | } |
226 | if (retval) { | 207 | |
208 | if (retval == -ENOSPC) { | ||
227 | pr_err("%s: FAILED, IDR is FULL\n", __func__); | 209 | pr_err("%s: FAILED, IDR is FULL\n", __func__); |
228 | status = -EPERM; | 210 | return -EPERM; |
211 | } else { | ||
212 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
213 | return -ENOMEM; | ||
229 | } | 214 | } |
230 | |||
231 | func_end: | ||
232 | return status; | ||
233 | } | 215 | } |
234 | 216 | ||
235 | static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt) | 217 | static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt) |
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 22918a106d73..d2479b766450 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c | |||
@@ -790,7 +790,7 @@ u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) | |||
790 | if ((~uLowNextTBTT) < uLowRemain) | 790 | if ((~uLowNextTBTT) < uLowRemain) |
791 | qwTSF = ((qwTSF >> 32) + 1) << 32; | 791 | qwTSF = ((qwTSF >> 32) + 1) << 32; |
792 | 792 | ||
793 | qwTSF = (qwTSF & 0xffffffff00000000UL) | | 793 | qwTSF = (qwTSF & 0xffffffff00000000ULL) | |
794 | (u64)(uLowNextTBTT + uLowRemain); | 794 | (u64)(uLowNextTBTT + uLowRemain); |
795 | 795 | ||
796 | return (qwTSF); | 796 | return (qwTSF); |
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index d5f53e1a74a2..a5063a6f64d9 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c | |||
@@ -669,8 +669,6 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) | |||
669 | if (device->flags & DEVICE_FLAGS_OPENED) | 669 | if (device->flags & DEVICE_FLAGS_OPENED) |
670 | device_close(device->dev); | 670 | device_close(device->dev); |
671 | 671 | ||
672 | usb_put_dev(interface_to_usbdev(intf)); | ||
673 | |||
674 | return 0; | 672 | return 0; |
675 | } | 673 | } |
676 | 674 | ||
@@ -681,8 +679,6 @@ static int vt6656_resume(struct usb_interface *intf) | |||
681 | if (!device || !device->dev) | 679 | if (!device || !device->dev) |
682 | return -ENODEV; | 680 | return -ENODEV; |
683 | 681 | ||
684 | usb_get_dev(interface_to_usbdev(intf)); | ||
685 | |||
686 | if (!(device->flags & DEVICE_FLAGS_OPENED)) | 682 | if (!(device->flags & DEVICE_FLAGS_OPENED)) |
687 | device_open(device->dev); | 683 | device_open(device->dev); |
688 | 684 | ||
diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig index 73582705e8c5..5c3714530961 100644 --- a/drivers/staging/zcache/Kconfig +++ b/drivers/staging/zcache/Kconfig | |||
@@ -15,7 +15,7 @@ config RAMSTER | |||
15 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE=y | 15 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE=y |
16 | depends on NET | 16 | depends on NET |
17 | # must ensure struct page is 8-byte aligned | 17 | # must ensure struct page is 8-byte aligned |
18 | select HAVE_ALIGNED_STRUCT_PAGE if !64_BIT | 18 | select HAVE_ALIGNED_STRUCT_PAGE if !64BIT |
19 | default n | 19 | default n |
20 | help | 20 | help |
21 | RAMster allows RAM on other machines in a cluster to be utilized | 21 | RAMster allows RAM on other machines in a cluster to be utilized |
diff --git a/drivers/staging/zcache/ramster/tcp.c b/drivers/staging/zcache/ramster/tcp.c index aa2a1a763aa4..f6e1e5209d88 100644 --- a/drivers/staging/zcache/ramster/tcp.c +++ b/drivers/staging/zcache/ramster/tcp.c | |||
@@ -300,27 +300,22 @@ static u8 r2net_num_from_nn(struct r2net_node *nn) | |||
300 | 300 | ||
301 | static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw) | 301 | static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw) |
302 | { | 302 | { |
303 | int ret = 0; | 303 | int ret; |
304 | 304 | ||
305 | do { | 305 | spin_lock(&nn->nn_lock); |
306 | if (!idr_pre_get(&nn->nn_status_idr, GFP_ATOMIC)) { | 306 | ret = idr_alloc(&nn->nn_status_idr, nsw, 0, 0, GFP_ATOMIC); |
307 | ret = -EAGAIN; | 307 | if (ret >= 0) { |
308 | break; | 308 | nsw->ns_id = ret; |
309 | } | 309 | list_add_tail(&nsw->ns_node_item, &nn->nn_status_list); |
310 | spin_lock(&nn->nn_lock); | 310 | } |
311 | ret = idr_get_new(&nn->nn_status_idr, nsw, &nsw->ns_id); | 311 | spin_unlock(&nn->nn_lock); |
312 | if (ret == 0) | ||
313 | list_add_tail(&nsw->ns_node_item, | ||
314 | &nn->nn_status_list); | ||
315 | spin_unlock(&nn->nn_lock); | ||
316 | } while (ret == -EAGAIN); | ||
317 | 312 | ||
318 | if (ret == 0) { | 313 | if (ret >= 0) { |
319 | init_waitqueue_head(&nsw->ns_wq); | 314 | init_waitqueue_head(&nsw->ns_wq); |
320 | nsw->ns_sys_status = R2NET_ERR_NONE; | 315 | nsw->ns_sys_status = R2NET_ERR_NONE; |
321 | nsw->ns_status = 0; | 316 | nsw->ns_status = 0; |
317 | return 0; | ||
322 | } | 318 | } |
323 | |||
324 | return ret; | 319 | return ret; |
325 | } | 320 | } |
326 | 321 | ||
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index db0cf7c8adde..a0fc7b9eea65 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -166,6 +166,7 @@ static int chap_server_compute_md5( | |||
166 | { | 166 | { |
167 | char *endptr; | 167 | char *endptr; |
168 | unsigned long id; | 168 | unsigned long id; |
169 | unsigned char id_as_uchar; | ||
169 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 170 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
170 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; | 171 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; |
171 | unsigned char identifier[10], *challenge = NULL; | 172 | unsigned char identifier[10], *challenge = NULL; |
@@ -355,7 +356,9 @@ static int chap_server_compute_md5( | |||
355 | goto out; | 356 | goto out; |
356 | } | 357 | } |
357 | 358 | ||
358 | sg_init_one(&sg, &id, 1); | 359 | /* To handle both endiannesses */ |
360 | id_as_uchar = id; | ||
361 | sg_init_one(&sg, &id_as_uchar, 1); | ||
359 | ret = crypto_hash_update(&desc, &sg, 1); | 362 | ret = crypto_hash_update(&desc, &sg, 1); |
360 | if (ret < 0) { | 363 | if (ret < 0) { |
361 | pr_err("crypto_hash_update() failed for id\n"); | 364 | pr_err("crypto_hash_update() failed for id\n"); |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index ff1c5ee352cb..cbe48ab41745 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -409,6 +409,7 @@ static inline int core_alua_state_standby( | |||
409 | case REPORT_LUNS: | 409 | case REPORT_LUNS: |
410 | case RECEIVE_DIAGNOSTIC: | 410 | case RECEIVE_DIAGNOSTIC: |
411 | case SEND_DIAGNOSTIC: | 411 | case SEND_DIAGNOSTIC: |
412 | return 0; | ||
412 | case MAINTENANCE_IN: | 413 | case MAINTENANCE_IN: |
413 | switch (cdb[1] & 0x1f) { | 414 | switch (cdb[1] & 0x1f) { |
414 | case MI_REPORT_TARGET_PGS: | 415 | case MI_REPORT_TARGET_PGS: |
@@ -451,6 +452,7 @@ static inline int core_alua_state_unavailable( | |||
451 | switch (cdb[0]) { | 452 | switch (cdb[0]) { |
452 | case INQUIRY: | 453 | case INQUIRY: |
453 | case REPORT_LUNS: | 454 | case REPORT_LUNS: |
455 | return 0; | ||
454 | case MAINTENANCE_IN: | 456 | case MAINTENANCE_IN: |
455 | switch (cdb[1] & 0x1f) { | 457 | switch (cdb[1] & 0x1f) { |
456 | case MI_REPORT_TARGET_PGS: | 458 | case MI_REPORT_TARGET_PGS: |
@@ -491,6 +493,7 @@ static inline int core_alua_state_transition( | |||
491 | switch (cdb[0]) { | 493 | switch (cdb[0]) { |
492 | case INQUIRY: | 494 | case INQUIRY: |
493 | case REPORT_LUNS: | 495 | case REPORT_LUNS: |
496 | return 0; | ||
494 | case MAINTENANCE_IN: | 497 | case MAINTENANCE_IN: |
495 | switch (cdb[1] & 0x1f) { | 498 | switch (cdb[1] & 0x1f) { |
496 | case MI_REPORT_TARGET_PGS: | 499 | case MI_REPORT_TARGET_PGS: |
diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h index bc02b018ae46..37ffc5bd2399 100644 --- a/drivers/target/target_core_file.h +++ b/drivers/target/target_core_file.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #define FD_DEVICE_QUEUE_DEPTH 32 | 7 | #define FD_DEVICE_QUEUE_DEPTH 32 |
8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 | 8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 |
9 | #define FD_BLOCKSIZE 512 | 9 | #define FD_BLOCKSIZE 512 |
10 | #define FD_MAX_SECTORS 1024 | 10 | #define FD_MAX_SECTORS 2048 |
11 | 11 | ||
12 | #define RRF_EMULATE_CDB 0x01 | 12 | #define RRF_EMULATE_CDB 0x01 |
13 | #define RRF_GOT_LBA 0x02 | 13 | #define RRF_GOT_LBA 0x02 |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 82e78d72fdb6..e992b27aa090 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -883,7 +883,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, | 883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, |
884 | page, len, off); | 884 | page, len, off); |
885 | 885 | ||
886 | while (len > 0 && data_len > 0) { | 886 | /* |
887 | * We only have one page of data in each sg element, | ||
888 | * we can not cross a page boundary. | ||
889 | */ | ||
890 | if (off + len > PAGE_SIZE) | ||
891 | goto fail; | ||
892 | |||
893 | if (len > 0 && data_len > 0) { | ||
887 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); | 894 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); |
888 | bytes = min(bytes, data_len); | 895 | bytes = min(bytes, data_len); |
889 | 896 | ||
@@ -940,9 +947,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
940 | bio = NULL; | 947 | bio = NULL; |
941 | } | 948 | } |
942 | 949 | ||
943 | len -= bytes; | ||
944 | data_len -= bytes; | 950 | data_len -= bytes; |
945 | off = 0; | ||
946 | } | 951 | } |
947 | } | 952 | } |
948 | 953 | ||
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 290230de2c53..60d4b5185f32 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -464,8 +464,11 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | |||
464 | break; | 464 | break; |
465 | case SYNCHRONIZE_CACHE: | 465 | case SYNCHRONIZE_CACHE: |
466 | case SYNCHRONIZE_CACHE_16: | 466 | case SYNCHRONIZE_CACHE_16: |
467 | if (!ops->execute_sync_cache) | 467 | if (!ops->execute_sync_cache) { |
468 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 468 | size = 0; |
469 | cmd->execute_cmd = sbc_emulate_noop; | ||
470 | break; | ||
471 | } | ||
469 | 472 | ||
470 | /* | 473 | /* |
471 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE | 474 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 9169d6a5d7e4..aac9d2727e3c 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -711,7 +711,8 @@ int core_tpg_register( | |||
711 | 711 | ||
712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { | 712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { |
713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { | 713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { |
714 | kfree(se_tpg); | 714 | array_free(se_tpg->tpg_lun_list, |
715 | TRANSPORT_MAX_LUNS_PER_TPG); | ||
715 | return -ENOMEM; | 716 | return -ENOMEM; |
716 | } | 717 | } |
717 | } | 718 | } |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 2030b608136d..3243ea790eab 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1139,8 +1139,10 @@ target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned char *cdb) | |||
1139 | return ret; | 1139 | return ret; |
1140 | 1140 | ||
1141 | ret = target_check_reservation(cmd); | 1141 | ret = target_check_reservation(cmd); |
1142 | if (ret) | 1142 | if (ret) { |
1143 | cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT; | ||
1143 | return ret; | 1144 | return ret; |
1145 | } | ||
1144 | 1146 | ||
1145 | ret = dev->transport->parse_cdb(cmd); | 1147 | ret = dev->transport->parse_cdb(cmd); |
1146 | if (ret) | 1148 | if (ret) |
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 7b0bfa0e7a9c..3078c403b42d 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c | |||
@@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev) | |||
143 | if (!priv) | 143 | if (!priv) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | 145 | ||
146 | priv->sensor = devm_request_and_ioremap(&pdev->dev, res); | 146 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
147 | if (!priv->sensor) { | 147 | if (IS_ERR(priv->sensor)) |
148 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 148 | return PTR_ERR(priv->sensor); |
149 | return -EADDRNOTAVAIL; | ||
150 | } | ||
151 | 149 | ||
152 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 150 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
153 | if (!res) { | 151 | if (!res) { |
154 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | 152 | dev_err(&pdev->dev, "Failed to get platform resource\n"); |
155 | return -ENODEV; | 153 | return -ENODEV; |
156 | } | 154 | } |
157 | priv->control = devm_request_and_ioremap(&pdev->dev, res); | 155 | priv->control = devm_ioremap_resource(&pdev->dev, res); |
158 | if (!priv->control) { | 156 | if (IS_ERR(priv->control)) |
159 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 157 | return PTR_ERR(priv->control); |
160 | return -EADDRNOTAVAIL; | ||
161 | } | ||
162 | 158 | ||
163 | ret = dove_init_sensor(priv); | 159 | ret = dove_init_sensor(priv); |
164 | if (ret) { | 160 | if (ret) { |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index e04ebd8671ac..46568c078dee 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) | |||
476 | 476 | ||
477 | if (IS_ERR(th_zone->therm_dev)) { | 477 | if (IS_ERR(th_zone->therm_dev)) { |
478 | pr_err("Failed to register thermal zone device\n"); | 478 | pr_err("Failed to register thermal zone device\n"); |
479 | ret = -EINVAL; | 479 | ret = PTR_ERR(th_zone->therm_dev); |
480 | goto err_unregister; | 480 | goto err_unregister; |
481 | } | 481 | } |
482 | th_zone->mode = THERMAL_DEVICE_ENABLED; | 482 | th_zone->mode = THERMAL_DEVICE_ENABLED; |
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 65cb4f09e8f6..e5500edb5285 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c | |||
@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) | |||
85 | if (!priv) | 85 | if (!priv) |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | 87 | ||
88 | priv->sensor = devm_request_and_ioremap(&pdev->dev, res); | 88 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
89 | if (!priv->sensor) { | 89 | if (IS_ERR(priv->sensor)) |
90 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 90 | return PTR_ERR(priv->sensor); |
91 | return -EADDRNOTAVAIL; | ||
92 | } | ||
93 | 91 | ||
94 | thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, | 92 | thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, |
95 | priv, &ops, NULL, 0, 0); | 93 | priv, &ops, NULL, 0, 0); |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 28f091994013..2cc5b6115e3e 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
145 | struct device *dev = rcar_priv_to_dev(priv); | 145 | struct device *dev = rcar_priv_to_dev(priv); |
146 | int i; | 146 | int i; |
147 | int ctemp, old, new; | 147 | int ctemp, old, new; |
148 | int ret = -EINVAL; | ||
148 | 149 | ||
149 | mutex_lock(&priv->lock); | 150 | mutex_lock(&priv->lock); |
150 | 151 | ||
@@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
174 | 175 | ||
175 | if (!ctemp) { | 176 | if (!ctemp) { |
176 | dev_err(dev, "thermal sensor was broken\n"); | 177 | dev_err(dev, "thermal sensor was broken\n"); |
177 | return -EINVAL; | 178 | goto err_out_unlock; |
178 | } | 179 | } |
179 | 180 | ||
180 | /* | 181 | /* |
@@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
192 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); | 193 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); |
193 | 194 | ||
194 | priv->ctemp = ctemp; | 195 | priv->ctemp = ctemp; |
195 | 196 | ret = 0; | |
197 | err_out_unlock: | ||
196 | mutex_unlock(&priv->lock); | 198 | mutex_unlock(&priv->lock); |
197 | 199 | return ret; | |
198 | return 0; | ||
199 | } | 200 | } |
200 | 201 | ||
201 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, | 202 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, |
@@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
363 | struct resource *res, *irq; | 364 | struct resource *res, *irq; |
364 | int mres = 0; | 365 | int mres = 0; |
365 | int i; | 366 | int i; |
367 | int ret = -ENODEV; | ||
366 | int idle = IDLE_INTERVAL; | 368 | int idle = IDLE_INTERVAL; |
367 | 369 | ||
368 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); | 370 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
@@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
399 | /* | 401 | /* |
400 | * rcar_has_irq_support() will be enabled | 402 | * rcar_has_irq_support() will be enabled |
401 | */ | 403 | */ |
402 | common->base = devm_request_and_ioremap(dev, res); | 404 | common->base = devm_ioremap_resource(dev, res); |
403 | if (!common->base) { | 405 | if (IS_ERR(common->base)) |
404 | dev_err(dev, "Unable to ioremap thermal register\n"); | 406 | return PTR_ERR(common->base); |
405 | return -ENOMEM; | ||
406 | } | ||
407 | 407 | ||
408 | /* enable temperature comparation */ | 408 | /* enable temperature comparation */ |
409 | rcar_thermal_common_write(common, ENR, 0x00030303); | 409 | rcar_thermal_common_write(common, ENR, 0x00030303); |
@@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
422 | return -ENOMEM; | 422 | return -ENOMEM; |
423 | } | 423 | } |
424 | 424 | ||
425 | priv->base = devm_request_and_ioremap(dev, res); | 425 | priv->base = devm_ioremap_resource(dev, res); |
426 | if (!priv->base) { | 426 | if (IS_ERR(priv->base)) |
427 | dev_err(dev, "Unable to ioremap priv register\n"); | 427 | return PTR_ERR(priv->base); |
428 | return -ENOMEM; | ||
429 | } | ||
430 | 428 | ||
431 | priv->common = common; | 429 | priv->common = common; |
432 | priv->id = i; | 430 | priv->id = i; |
@@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
441 | idle); | 439 | idle); |
442 | if (IS_ERR(priv->zone)) { | 440 | if (IS_ERR(priv->zone)) { |
443 | dev_err(dev, "can't register thermal zone\n"); | 441 | dev_err(dev, "can't register thermal zone\n"); |
442 | ret = PTR_ERR(priv->zone); | ||
444 | goto error_unregister; | 443 | goto error_unregister; |
445 | } | 444 | } |
446 | 445 | ||
@@ -460,7 +459,7 @@ error_unregister: | |||
460 | rcar_thermal_for_each_priv(priv, common) | 459 | rcar_thermal_for_each_priv(priv, common) |
461 | thermal_zone_device_unregister(priv->zone); | 460 | thermal_zone_device_unregister(priv->zone); |
462 | 461 | ||
463 | return -ENODEV; | 462 | return ret; |
464 | } | 463 | } |
465 | 464 | ||
466 | static int rcar_thermal_remove(struct platform_device *pdev) | 465 | static int rcar_thermal_remove(struct platform_device *pdev) |
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 484b6a3c9b03..302909ccf183 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c | |||
@@ -2643,9 +2643,9 @@ static int mxser_probe(struct pci_dev *pdev, | |||
2643 | mxvar_sdriver, brd->idx + i, &pdev->dev); | 2643 | mxvar_sdriver, brd->idx + i, &pdev->dev); |
2644 | if (IS_ERR(tty_dev)) { | 2644 | if (IS_ERR(tty_dev)) { |
2645 | retval = PTR_ERR(tty_dev); | 2645 | retval = PTR_ERR(tty_dev); |
2646 | for (i--; i >= 0; i--) | 2646 | for (; i > 0; i--) |
2647 | tty_unregister_device(mxvar_sdriver, | 2647 | tty_unregister_device(mxvar_sdriver, |
2648 | brd->idx + i); | 2648 | brd->idx + i - 1); |
2649 | goto err_relbrd; | 2649 | goto err_relbrd; |
2650 | } | 2650 | } |
2651 | } | 2651 | } |
@@ -2751,9 +2751,9 @@ static int __init mxser_module_init(void) | |||
2751 | tty_dev = tty_port_register_device(&brd->ports[i].port, | 2751 | tty_dev = tty_port_register_device(&brd->ports[i].port, |
2752 | mxvar_sdriver, brd->idx + i, NULL); | 2752 | mxvar_sdriver, brd->idx + i, NULL); |
2753 | if (IS_ERR(tty_dev)) { | 2753 | if (IS_ERR(tty_dev)) { |
2754 | for (i--; i >= 0; i--) | 2754 | for (; i > 0; i--) |
2755 | tty_unregister_device(mxvar_sdriver, | 2755 | tty_unregister_device(mxvar_sdriver, |
2756 | brd->idx + i); | 2756 | brd->idx + i - 1); |
2757 | for (i = 0; i < brd->info->nports; i++) | 2757 | for (i = 0; i < brd->info->nports; i++) |
2758 | tty_port_destroy(&brd->ports[i].port); | 2758 | tty_port_destroy(&brd->ports[i].port); |
2759 | free_irq(brd->irq, brd); | 2759 | free_irq(brd->irq, brd); |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250_core.c index 0efc815a4968..35f9c96aada9 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -301,7 +301,28 @@ static const struct serial8250_config uart_config[] = { | |||
301 | }, | 301 | }, |
302 | [PORT_8250_CIR] = { | 302 | [PORT_8250_CIR] = { |
303 | .name = "CIR port" | 303 | .name = "CIR port" |
304 | } | 304 | }, |
305 | [PORT_ALTR_16550_F32] = { | ||
306 | .name = "Altera 16550 FIFO32", | ||
307 | .fifo_size = 32, | ||
308 | .tx_loadsz = 32, | ||
309 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
310 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
311 | }, | ||
312 | [PORT_ALTR_16550_F64] = { | ||
313 | .name = "Altera 16550 FIFO64", | ||
314 | .fifo_size = 64, | ||
315 | .tx_loadsz = 64, | ||
316 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
317 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
318 | }, | ||
319 | [PORT_ALTR_16550_F128] = { | ||
320 | .name = "Altera 16550 FIFO128", | ||
321 | .fifo_size = 128, | ||
322 | .tx_loadsz = 128, | ||
323 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
324 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
325 | }, | ||
305 | }; | 326 | }; |
306 | 327 | ||
307 | /* Uart divisor latch read */ | 328 | /* Uart divisor latch read */ |
@@ -3396,3 +3417,34 @@ module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444); | |||
3396 | MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); | 3417 | MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); |
3397 | #endif | 3418 | #endif |
3398 | MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR); | 3419 | MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR); |
3420 | |||
3421 | #ifdef CONFIG_SERIAL_8250_DEPRECATED_OPTIONS | ||
3422 | #ifndef MODULE | ||
3423 | /* This module was renamed to 8250_core in 3.7. Keep the old "8250" name | ||
3424 | * working as well for the module options so we don't break people. We | ||
3425 | * need to keep the names identical and the convenient macros will happily | ||
3426 | * refuse to let us do that by failing the build with redefinition errors | ||
3427 | * of global variables. So we stick them inside a dummy function to avoid | ||
3428 | * those conflicts. The options still get parsed, and the redefined | ||
3429 | * MODULE_PARAM_PREFIX lets us keep the "8250." syntax alive. | ||
3430 | * | ||
3431 | * This is hacky. I'm sorry. | ||
3432 | */ | ||
3433 | static void __used s8250_options(void) | ||
3434 | { | ||
3435 | #undef MODULE_PARAM_PREFIX | ||
3436 | #define MODULE_PARAM_PREFIX "8250_core." | ||
3437 | |||
3438 | module_param_cb(share_irqs, ¶m_ops_uint, &share_irqs, 0644); | ||
3439 | module_param_cb(nr_uarts, ¶m_ops_uint, &nr_uarts, 0644); | ||
3440 | module_param_cb(skip_txen_test, ¶m_ops_uint, &skip_txen_test, 0644); | ||
3441 | #ifdef CONFIG_SERIAL_8250_RSA | ||
3442 | __module_param_call(MODULE_PARAM_PREFIX, probe_rsa, | ||
3443 | ¶m_array_ops, .arr = &__param_arr_probe_rsa, | ||
3444 | 0444, -1); | ||
3445 | #endif | ||
3446 | } | ||
3447 | #else | ||
3448 | MODULE_ALIAS("8250_core"); | ||
3449 | #endif | ||
3450 | #endif | ||
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 791c5a77ec61..26e3a97ab157 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1554,6 +1554,7 @@ pci_wch_ch353_setup(struct serial_private *priv, | |||
1554 | #define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001 | 1554 | #define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001 |
1555 | #define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d | 1555 | #define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d |
1556 | #define PCI_VENDOR_ID_WCH 0x4348 | 1556 | #define PCI_VENDOR_ID_WCH 0x4348 |
1557 | #define PCI_DEVICE_ID_WCH_CH352_2S 0x3253 | ||
1557 | #define PCI_DEVICE_ID_WCH_CH353_4S 0x3453 | 1558 | #define PCI_DEVICE_ID_WCH_CH353_4S 0x3453 |
1558 | #define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046 | 1559 | #define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046 |
1559 | #define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053 | 1560 | #define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053 |
@@ -1571,6 +1572,7 @@ pci_wch_ch353_setup(struct serial_private *priv, | |||
1571 | 1572 | ||
1572 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ | 1573 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ |
1573 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 | 1574 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 |
1575 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588 | ||
1574 | 1576 | ||
1575 | /* | 1577 | /* |
1576 | * Master list of serial port init/setup/exit quirks. | 1578 | * Master list of serial port init/setup/exit quirks. |
@@ -1852,15 +1854,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
1852 | }, | 1854 | }, |
1853 | { | 1855 | { |
1854 | .vendor = PCI_VENDOR_ID_PLX, | 1856 | .vendor = PCI_VENDOR_ID_PLX, |
1855 | .device = PCI_DEVICE_ID_PLX_9050, | ||
1856 | .subvendor = PCI_VENDOR_ID_PLX, | ||
1857 | .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584, | ||
1858 | .init = pci_plx9050_init, | ||
1859 | .setup = pci_default_setup, | ||
1860 | .exit = pci_plx9050_exit, | ||
1861 | }, | ||
1862 | { | ||
1863 | .vendor = PCI_VENDOR_ID_PLX, | ||
1864 | .device = PCI_DEVICE_ID_PLX_ROMULUS, | 1857 | .device = PCI_DEVICE_ID_PLX_ROMULUS, |
1865 | .subvendor = PCI_VENDOR_ID_PLX, | 1858 | .subvendor = PCI_VENDOR_ID_PLX, |
1866 | .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, | 1859 | .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, |
@@ -2180,6 +2173,14 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
2180 | .subdevice = PCI_ANY_ID, | 2173 | .subdevice = PCI_ANY_ID, |
2181 | .setup = pci_wch_ch353_setup, | 2174 | .setup = pci_wch_ch353_setup, |
2182 | }, | 2175 | }, |
2176 | /* WCH CH352 2S card (16550 clone) */ | ||
2177 | { | ||
2178 | .vendor = PCI_VENDOR_ID_WCH, | ||
2179 | .device = PCI_DEVICE_ID_WCH_CH352_2S, | ||
2180 | .subvendor = PCI_ANY_ID, | ||
2181 | .subdevice = PCI_ANY_ID, | ||
2182 | .setup = pci_wch_ch353_setup, | ||
2183 | }, | ||
2183 | /* | 2184 | /* |
2184 | * ASIX devices with FIFO bug | 2185 | * ASIX devices with FIFO bug |
2185 | */ | 2186 | */ |
@@ -3733,7 +3734,12 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
3733 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 3734 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
3734 | PCI_VENDOR_ID_PLX, | 3735 | PCI_VENDOR_ID_PLX, |
3735 | PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, | 3736 | PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, |
3736 | pbn_b0_4_115200 }, | 3737 | pbn_b2_4_115200 }, |
3738 | /* Unknown card - subdevice 0x1588 */ | ||
3739 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | ||
3740 | PCI_VENDOR_ID_PLX, | ||
3741 | PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0, | ||
3742 | pbn_b2_8_115200 }, | ||
3737 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 3743 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
3738 | PCI_SUBVENDOR_ID_KEYSPAN, | 3744 | PCI_SUBVENDOR_ID_KEYSPAN, |
3739 | PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, | 3745 | PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, |
@@ -4791,6 +4797,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
4791 | PCI_VENDOR_ID_IBM, 0x0299, | 4797 | PCI_VENDOR_ID_IBM, 0x0299, |
4792 | 0, 0, pbn_b0_bt_2_115200 }, | 4798 | 0, 0, pbn_b0_bt_2_115200 }, |
4793 | 4799 | ||
4800 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, | ||
4801 | 0x1000, 0x0012, | ||
4802 | 0, 0, pbn_b0_bt_2_115200 }, | ||
4803 | |||
4794 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901, | 4804 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901, |
4795 | 0xA000, 0x1000, | 4805 | 0xA000, 0x1000, |
4796 | 0, 0, pbn_b0_1_115200 }, | 4806 | 0, 0, pbn_b0_1_115200 }, |
@@ -4869,6 +4879,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
4869 | PCI_ANY_ID, PCI_ANY_ID, | 4879 | PCI_ANY_ID, PCI_ANY_ID, |
4870 | 0, 0, pbn_b0_bt_2_115200 }, | 4880 | 0, 0, pbn_b0_bt_2_115200 }, |
4871 | 4881 | ||
4882 | { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH352_2S, | ||
4883 | PCI_ANY_ID, PCI_ANY_ID, | ||
4884 | 0, 0, pbn_b0_bt_2_115200 }, | ||
4885 | |||
4872 | /* | 4886 | /* |
4873 | * Commtech, Inc. Fastcom adapters | 4887 | * Commtech, Inc. Fastcom adapters |
4874 | */ | 4888 | */ |
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig index 2ef9537bcb2c..80fe91e64a52 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig | |||
@@ -33,6 +33,23 @@ config SERIAL_8250 | |||
33 | Most people will say Y or M here, so that they can use serial mice, | 33 | Most people will say Y or M here, so that they can use serial mice, |
34 | modems and similar devices connecting to the standard serial ports. | 34 | modems and similar devices connecting to the standard serial ports. |
35 | 35 | ||
36 | config SERIAL_8250_DEPRECATED_OPTIONS | ||
37 | bool "Support 8250_core.* kernel options (DEPRECATED)" | ||
38 | depends on SERIAL_8250 | ||
39 | default y | ||
40 | ---help--- | ||
41 | In 3.7 we renamed 8250 to 8250_core by mistake, so now we have to | ||
42 | accept kernel parameters in both forms like 8250_core.nr_uarts=4 and | ||
43 | 8250.nr_uarts=4. We now renamed the module back to 8250, but if | ||
44 | anybody noticed in 3.7 and changed their userspace we still have to | ||
45 | keep the 8350_core.* options around until they revert the changes | ||
46 | they already did. | ||
47 | |||
48 | If 8250 is built as a module, this adds 8250_core alias instead. | ||
49 | |||
50 | If you did not notice yet and/or you have userspace from pre-3.7, it | ||
51 | is safe (and recommended) to say N here. | ||
52 | |||
36 | config SERIAL_8250_PNP | 53 | config SERIAL_8250_PNP |
37 | bool "8250/16550 PNP device support" if EXPERT | 54 | bool "8250/16550 PNP device support" if EXPERT |
38 | depends on SERIAL_8250 && PNP | 55 | depends on SERIAL_8250 && PNP |
diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile index a23838a4d535..36d68d054307 100644 --- a/drivers/tty/serial/8250/Makefile +++ b/drivers/tty/serial/8250/Makefile | |||
@@ -2,10 +2,10 @@ | |||
2 | # Makefile for the 8250 serial device drivers. | 2 | # Makefile for the 8250 serial device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_SERIAL_8250) += 8250_core.o | 5 | obj-$(CONFIG_SERIAL_8250) += 8250.o |
6 | 8250_core-y := 8250.o | 6 | 8250-y := 8250_core.o |
7 | 8250_core-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o | 7 | 8250-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o |
8 | 8250_core-$(CONFIG_SERIAL_8250_DMA) += 8250_dma.o | 8 | 8250-$(CONFIG_SERIAL_8250_DMA) += 8250_dma.o |
9 | obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o | 9 | obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o |
10 | obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o | 10 | obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o |
11 | obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o | 11 | obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index cf9210db9fa9..7e7006fd404e 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -211,14 +211,14 @@ config SERIAL_SAMSUNG | |||
211 | config SERIAL_SAMSUNG_UARTS_4 | 211 | config SERIAL_SAMSUNG_UARTS_4 |
212 | bool | 212 | bool |
213 | depends on PLAT_SAMSUNG | 213 | depends on PLAT_SAMSUNG |
214 | default y if !(CPU_S3C2410 || SERIAL_S3C2412 || CPU_S3C2440 || CPU_S3C2442) | 214 | default y if !(CPU_S3C2410 || CPU_S3C2412 || CPU_S3C2440 || CPU_S3C2442) |
215 | help | 215 | help |
216 | Internal node for the common case of 4 Samsung compatible UARTs | 216 | Internal node for the common case of 4 Samsung compatible UARTs |
217 | 217 | ||
218 | config SERIAL_SAMSUNG_UARTS | 218 | config SERIAL_SAMSUNG_UARTS |
219 | int | 219 | int |
220 | depends on PLAT_SAMSUNG | 220 | depends on PLAT_SAMSUNG |
221 | default 6 if ARCH_S5P6450 | 221 | default 6 if CPU_S5P6450 |
222 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 | 222 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 |
223 | default 3 | 223 | default 3 |
224 | help | 224 | help |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index d4a7c241b751..3467462869ce 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -158,7 +158,7 @@ struct atmel_uart_port { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART]; | 160 | static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART]; |
161 | static unsigned long atmel_ports_in_use; | 161 | static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART); |
162 | 162 | ||
163 | #ifdef SUPPORT_SYSRQ | 163 | #ifdef SUPPORT_SYSRQ |
164 | static struct console atmel_console; | 164 | static struct console atmel_console; |
@@ -1769,15 +1769,14 @@ static int atmel_serial_probe(struct platform_device *pdev) | |||
1769 | if (ret < 0) | 1769 | if (ret < 0) |
1770 | /* port id not found in platform data nor device-tree aliases: | 1770 | /* port id not found in platform data nor device-tree aliases: |
1771 | * auto-enumerate it */ | 1771 | * auto-enumerate it */ |
1772 | ret = find_first_zero_bit(&atmel_ports_in_use, | 1772 | ret = find_first_zero_bit(atmel_ports_in_use, ATMEL_MAX_UART); |
1773 | sizeof(atmel_ports_in_use)); | ||
1774 | 1773 | ||
1775 | if (ret > ATMEL_MAX_UART) { | 1774 | if (ret >= ATMEL_MAX_UART) { |
1776 | ret = -ENODEV; | 1775 | ret = -ENODEV; |
1777 | goto err; | 1776 | goto err; |
1778 | } | 1777 | } |
1779 | 1778 | ||
1780 | if (test_and_set_bit(ret, &atmel_ports_in_use)) { | 1779 | if (test_and_set_bit(ret, atmel_ports_in_use)) { |
1781 | /* port already in use */ | 1780 | /* port already in use */ |
1782 | ret = -EBUSY; | 1781 | ret = -EBUSY; |
1783 | goto err; | 1782 | goto err; |
@@ -1857,7 +1856,7 @@ static int atmel_serial_remove(struct platform_device *pdev) | |||
1857 | 1856 | ||
1858 | /* "port" is allocated statically, so we shouldn't free it */ | 1857 | /* "port" is allocated statically, so we shouldn't free it */ |
1859 | 1858 | ||
1860 | clear_bit(port->line, &atmel_ports_in_use); | 1859 | clear_bit(port->line, atmel_ports_in_use); |
1861 | 1860 | ||
1862 | clk_put(atmel_port->clk); | 1861 | clk_put(atmel_port->clk); |
1863 | 1862 | ||
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index 719594e5fc21..52a3ecd40421 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -235,7 +235,7 @@ static const char *bcm_uart_type(struct uart_port *port) | |||
235 | */ | 235 | */ |
236 | static void bcm_uart_do_rx(struct uart_port *port) | 236 | static void bcm_uart_do_rx(struct uart_port *port) |
237 | { | 237 | { |
238 | struct tty_port *port = &port->state->port; | 238 | struct tty_port *tty_port = &port->state->port; |
239 | unsigned int max_count; | 239 | unsigned int max_count; |
240 | 240 | ||
241 | /* limit number of char read in interrupt, should not be | 241 | /* limit number of char read in interrupt, should not be |
@@ -260,7 +260,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
260 | bcm_uart_writel(port, val, UART_CTL_REG); | 260 | bcm_uart_writel(port, val, UART_CTL_REG); |
261 | 261 | ||
262 | port->icount.overrun++; | 262 | port->icount.overrun++; |
263 | tty_insert_flip_char(port, 0, TTY_OVERRUN); | 263 | tty_insert_flip_char(tty_port, 0, TTY_OVERRUN); |
264 | } | 264 | } |
265 | 265 | ||
266 | if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) | 266 | if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) |
@@ -299,11 +299,11 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
299 | 299 | ||
300 | 300 | ||
301 | if ((cstat & port->ignore_status_mask) == 0) | 301 | if ((cstat & port->ignore_status_mask) == 0) |
302 | tty_insert_flip_char(port, c, flag); | 302 | tty_insert_flip_char(tty_port, c, flag); |
303 | 303 | ||
304 | } while (--max_count); | 304 | } while (--max_count); |
305 | 305 | ||
306 | tty_flip_buffer_push(port); | 306 | tty_flip_buffer_push(tty_port); |
307 | } | 307 | } |
308 | 308 | ||
309 | /* | 309 | /* |
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index c0e1fad51be7..018bad922554 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c | |||
@@ -550,7 +550,7 @@ static int mpc512x_psc_clock(struct uart_port *port, int enable) | |||
550 | return 0; | 550 | return 0; |
551 | 551 | ||
552 | psc_num = (port->mapbase & 0xf00) >> 8; | 552 | psc_num = (port->mapbase & 0xf00) >> 8; |
553 | snprintf(clk_name, sizeof(clk_name), "psc%d_clk", psc_num); | 553 | snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); |
554 | psc_clk = clk_get(port->dev, clk_name); | 554 | psc_clk = clk_get(port->dev, clk_name); |
555 | if (IS_ERR(psc_clk)) { | 555 | if (IS_ERR(psc_clk)) { |
556 | dev_err(port->dev, "Failed to get PSC clock entry!\n"); | 556 | dev_err(port->dev, "Failed to get PSC clock entry!\n"); |
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index d5874605682b..b025d5438275 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -241,6 +241,12 @@ static struct of_device_id of_platform_serial_table[] = { | |||
241 | { .compatible = "ns16850", .data = (void *)PORT_16850, }, | 241 | { .compatible = "ns16850", .data = (void *)PORT_16850, }, |
242 | { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, }, | 242 | { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, }, |
243 | { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, }, | 243 | { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, }, |
244 | { .compatible = "altr,16550-FIFO32", | ||
245 | .data = (void *)PORT_ALTR_16550_F32, }, | ||
246 | { .compatible = "altr,16550-FIFO64", | ||
247 | .data = (void *)PORT_ALTR_16550_F64, }, | ||
248 | { .compatible = "altr,16550-FIFO128", | ||
249 | .data = (void *)PORT_ALTR_16550_F128, }, | ||
244 | #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL | 250 | #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL |
245 | { .compatible = "ibm,qpace-nwp-serial", | 251 | { .compatible = "ibm,qpace-nwp-serial", |
246 | .data = (void *)PORT_NWPSERIAL, }, | 252 | .data = (void *)PORT_NWPSERIAL, }, |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 4dc41408ecb7..30d4f7a783cd 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -886,6 +886,17 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios, | |||
886 | serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); | 886 | serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); |
887 | /* FIFO ENABLE, DMA MODE */ | 887 | /* FIFO ENABLE, DMA MODE */ |
888 | 888 | ||
889 | up->scr |= OMAP_UART_SCR_RX_TRIG_GRANU1_MASK; | ||
890 | /* | ||
891 | * NOTE: Setting OMAP_UART_SCR_RX_TRIG_GRANU1_MASK | ||
892 | * sets Enables the granularity of 1 for TRIGGER RX | ||
893 | * level. Along with setting RX FIFO trigger level | ||
894 | * to 1 (as noted below, 16 characters) and TLR[3:0] | ||
895 | * to zero this will result RX FIFO threshold level | ||
896 | * to 1 character, instead of 16 as noted in comment | ||
897 | * below. | ||
898 | */ | ||
899 | |||
889 | /* Set receive FIFO threshold to 16 characters and | 900 | /* Set receive FIFO threshold to 16 characters and |
890 | * transmit FIFO threshold to 16 spaces | 901 | * transmit FIFO threshold to 16 spaces |
891 | */ | 902 | */ |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index e343d6670854..451687cb9685 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -968,6 +968,7 @@ static struct uart_ops sunsu_pops = { | |||
968 | #define UART_NR 4 | 968 | #define UART_NR 4 |
969 | 969 | ||
970 | static struct uart_sunsu_port sunsu_ports[UART_NR]; | 970 | static struct uart_sunsu_port sunsu_ports[UART_NR]; |
971 | static int nr_inst; /* Number of already registered ports */ | ||
971 | 972 | ||
972 | #ifdef CONFIG_SERIO | 973 | #ifdef CONFIG_SERIO |
973 | 974 | ||
@@ -1337,13 +1338,8 @@ static int __init sunsu_console_setup(struct console *co, char *options) | |||
1337 | printk("Console: ttyS%d (SU)\n", | 1338 | printk("Console: ttyS%d (SU)\n", |
1338 | (sunsu_reg.minor - 64) + co->index); | 1339 | (sunsu_reg.minor - 64) + co->index); |
1339 | 1340 | ||
1340 | /* | 1341 | if (co->index > nr_inst) |
1341 | * Check whether an invalid uart number has been specified, and | 1342 | return -ENODEV; |
1342 | * if so, search for the first available port that does have | ||
1343 | * console support. | ||
1344 | */ | ||
1345 | if (co->index >= UART_NR) | ||
1346 | co->index = 0; | ||
1347 | port = &sunsu_ports[co->index].port; | 1343 | port = &sunsu_ports[co->index].port; |
1348 | 1344 | ||
1349 | /* | 1345 | /* |
@@ -1408,7 +1404,6 @@ static enum su_type su_get_type(struct device_node *dp) | |||
1408 | 1404 | ||
1409 | static int su_probe(struct platform_device *op) | 1405 | static int su_probe(struct platform_device *op) |
1410 | { | 1406 | { |
1411 | static int inst; | ||
1412 | struct device_node *dp = op->dev.of_node; | 1407 | struct device_node *dp = op->dev.of_node; |
1413 | struct uart_sunsu_port *up; | 1408 | struct uart_sunsu_port *up; |
1414 | struct resource *rp; | 1409 | struct resource *rp; |
@@ -1418,16 +1413,16 @@ static int su_probe(struct platform_device *op) | |||
1418 | 1413 | ||
1419 | type = su_get_type(dp); | 1414 | type = su_get_type(dp); |
1420 | if (type == SU_PORT_PORT) { | 1415 | if (type == SU_PORT_PORT) { |
1421 | if (inst >= UART_NR) | 1416 | if (nr_inst >= UART_NR) |
1422 | return -EINVAL; | 1417 | return -EINVAL; |
1423 | up = &sunsu_ports[inst]; | 1418 | up = &sunsu_ports[nr_inst]; |
1424 | } else { | 1419 | } else { |
1425 | up = kzalloc(sizeof(*up), GFP_KERNEL); | 1420 | up = kzalloc(sizeof(*up), GFP_KERNEL); |
1426 | if (!up) | 1421 | if (!up) |
1427 | return -ENOMEM; | 1422 | return -ENOMEM; |
1428 | } | 1423 | } |
1429 | 1424 | ||
1430 | up->port.line = inst; | 1425 | up->port.line = nr_inst; |
1431 | 1426 | ||
1432 | spin_lock_init(&up->port.lock); | 1427 | spin_lock_init(&up->port.lock); |
1433 | 1428 | ||
@@ -1461,6 +1456,8 @@ static int su_probe(struct platform_device *op) | |||
1461 | } | 1456 | } |
1462 | dev_set_drvdata(&op->dev, up); | 1457 | dev_set_drvdata(&op->dev, up); |
1463 | 1458 | ||
1459 | nr_inst++; | ||
1460 | |||
1464 | return 0; | 1461 | return 0; |
1465 | } | 1462 | } |
1466 | 1463 | ||
@@ -1488,7 +1485,7 @@ static int su_probe(struct platform_device *op) | |||
1488 | 1485 | ||
1489 | dev_set_drvdata(&op->dev, up); | 1486 | dev_set_drvdata(&op->dev, up); |
1490 | 1487 | ||
1491 | inst++; | 1488 | nr_inst++; |
1492 | 1489 | ||
1493 | return 0; | 1490 | return 0; |
1494 | 1491 | ||
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index a3f9dd5c9dff..705240e6c4ec 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c | |||
@@ -611,14 +611,7 @@ static int vt8500_serial_probe(struct platform_device *pdev) | |||
611 | vt8500_port->uart.dev = &pdev->dev; | 611 | vt8500_port->uart.dev = &pdev->dev; |
612 | vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; | 612 | vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; |
613 | 613 | ||
614 | vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0); | 614 | vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk); |
615 | if (!IS_ERR(vt8500_port->clk)) { | ||
616 | vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk); | ||
617 | } else { | ||
618 | /* use the default of 24Mhz if not specified and warn */ | ||
619 | pr_warn("%s: serial clock source not specified\n", __func__); | ||
620 | vt8500_port->uart.uartclk = 24000000; | ||
621 | } | ||
622 | 615 | ||
623 | snprintf(vt8500_port->name, sizeof(vt8500_port->name), | 616 | snprintf(vt8500_port->name, sizeof(vt8500_port->name), |
624 | "VT8500 UART%d", pdev->id); | 617 | "VT8500 UART%d", pdev->id); |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index ba451c7209fc..f36bbba1ac8b 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -578,6 +578,8 @@ static int xuartps_startup(struct uart_port *port) | |||
578 | /* Receive Timeout register is enabled with value of 10 */ | 578 | /* Receive Timeout register is enabled with value of 10 */ |
579 | xuartps_writel(10, XUARTPS_RXTOUT_OFFSET); | 579 | xuartps_writel(10, XUARTPS_RXTOUT_OFFSET); |
580 | 580 | ||
581 | /* Clear out any pending interrupts before enabling them */ | ||
582 | xuartps_writel(xuartps_readl(XUARTPS_ISR_OFFSET), XUARTPS_ISR_OFFSET); | ||
581 | 583 | ||
582 | /* Set the Interrupt Registers with desired interrupts */ | 584 | /* Set the Interrupt Registers with desired interrupts */ |
583 | xuartps_writel(XUARTPS_IXR_TXEMPTY | XUARTPS_IXR_PARITY | | 585 | xuartps_writel(XUARTPS_IXR_TXEMPTY | XUARTPS_IXR_PARITY | |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index bb119934e76c..578aa7594b11 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -425,7 +425,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
425 | struct tty_ldisc *disc; | 425 | struct tty_ldisc *disc; |
426 | 426 | ||
427 | tty = port->itty; | 427 | tty = port->itty; |
428 | if (WARN_RATELIMIT(tty == NULL, "tty is NULL\n")) | 428 | if (tty == NULL) |
429 | return; | 429 | return; |
430 | 430 | ||
431 | disc = tty_ldisc_ref(tty); | 431 | disc = tty_ldisc_ref(tty); |
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index e4ca345873c3..d7799deacb21 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c | |||
@@ -93,7 +93,7 @@ vcs_poll_data_free(struct vcs_poll_data *poll) | |||
93 | static struct vcs_poll_data * | 93 | static struct vcs_poll_data * |
94 | vcs_poll_data_get(struct file *file) | 94 | vcs_poll_data_get(struct file *file) |
95 | { | 95 | { |
96 | struct vcs_poll_data *poll = file->private_data; | 96 | struct vcs_poll_data *poll = file->private_data, *kill = NULL; |
97 | 97 | ||
98 | if (poll) | 98 | if (poll) |
99 | return poll; | 99 | return poll; |
@@ -122,10 +122,12 @@ vcs_poll_data_get(struct file *file) | |||
122 | file->private_data = poll; | 122 | file->private_data = poll; |
123 | } else { | 123 | } else { |
124 | /* someone else raced ahead of us */ | 124 | /* someone else raced ahead of us */ |
125 | vcs_poll_data_free(poll); | 125 | kill = poll; |
126 | poll = file->private_data; | 126 | poll = file->private_data; |
127 | } | 127 | } |
128 | spin_unlock(&file->f_lock); | 128 | spin_unlock(&file->f_lock); |
129 | if (kill) | ||
130 | vcs_poll_data_free(kill); | ||
129 | 131 | ||
130 | return poll; | 132 | return poll; |
131 | } | 133 | } |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index f5ed3d75fa5a..8f5ebced5df0 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -46,7 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ | |||
46 | obj-$(CONFIG_USB_SERIAL) += serial/ | 46 | obj-$(CONFIG_USB_SERIAL) += serial/ |
47 | 47 | ||
48 | obj-$(CONFIG_USB) += misc/ | 48 | obj-$(CONFIG_USB) += misc/ |
49 | obj-$(CONFIG_USB_COMMON) += phy/ | 49 | obj-$(CONFIG_USB_OTG_UTILS) += phy/ |
50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ | 50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ |
51 | 51 | ||
52 | obj-$(CONFIG_USB_ATM) += atm/ | 52 | obj-$(CONFIG_USB_ATM) += atm/ |
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c index a03fbc15fa9c..aa491627a45b 100644 --- a/drivers/usb/c67x00/c67x00-sched.c +++ b/drivers/usb/c67x00/c67x00-sched.c | |||
@@ -100,7 +100,7 @@ struct c67x00_urb_priv { | |||
100 | #define TD_PIDEP_OFFSET 0x04 | 100 | #define TD_PIDEP_OFFSET 0x04 |
101 | #define TD_PIDEPMASK_PID 0xF0 | 101 | #define TD_PIDEPMASK_PID 0xF0 |
102 | #define TD_PIDEPMASK_EP 0x0F | 102 | #define TD_PIDEPMASK_EP 0x0F |
103 | #define TD_PORTLENMASK_DL 0x02FF | 103 | #define TD_PORTLENMASK_DL 0x03FF |
104 | #define TD_PORTLENMASK_PN 0xC000 | 104 | #define TD_PORTLENMASK_PN 0xC000 |
105 | 105 | ||
106 | #define TD_STATUS_OFFSET 0x07 | 106 | #define TD_STATUS_OFFSET 0x07 |
@@ -590,7 +590,7 @@ static int c67x00_create_td(struct c67x00_hcd *c67x00, struct urb *urb, | |||
590 | { | 590 | { |
591 | struct c67x00_td *td; | 591 | struct c67x00_td *td; |
592 | struct c67x00_urb_priv *urbp = urb->hcpriv; | 592 | struct c67x00_urb_priv *urbp = urb->hcpriv; |
593 | const __u8 active_flag = 1, retry_cnt = 1; | 593 | const __u8 active_flag = 1, retry_cnt = 3; |
594 | __u8 cmd = 0; | 594 | __u8 cmd = 0; |
595 | int tt = 0; | 595 | int tt = 0; |
596 | 596 | ||
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 2f45bba8561d..f64fbea1cf20 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -1767,7 +1767,7 @@ static int udc_start(struct ci13xxx *ci) | |||
1767 | goto put_transceiver; | 1767 | goto put_transceiver; |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | retval = dbg_create_files(&ci->gadget.dev); | 1770 | retval = dbg_create_files(ci->dev); |
1771 | if (retval) | 1771 | if (retval) |
1772 | goto unreg_device; | 1772 | goto unreg_device; |
1773 | 1773 | ||
@@ -1796,7 +1796,7 @@ remove_trans: | |||
1796 | 1796 | ||
1797 | dev_err(dev, "error = %i\n", retval); | 1797 | dev_err(dev, "error = %i\n", retval); |
1798 | remove_dbg: | 1798 | remove_dbg: |
1799 | dbg_remove_files(&ci->gadget.dev); | 1799 | dbg_remove_files(ci->dev); |
1800 | unreg_device: | 1800 | unreg_device: |
1801 | device_unregister(&ci->gadget.dev); | 1801 | device_unregister(&ci->gadget.dev); |
1802 | put_transceiver: | 1802 | put_transceiver: |
@@ -1836,7 +1836,7 @@ static void udc_stop(struct ci13xxx *ci) | |||
1836 | if (ci->global_phy) | 1836 | if (ci->global_phy) |
1837 | usb_put_phy(ci->transceiver); | 1837 | usb_put_phy(ci->transceiver); |
1838 | } | 1838 | } |
1839 | dbg_remove_files(&ci->gadget.dev); | 1839 | dbg_remove_files(ci->dev); |
1840 | device_unregister(&ci->gadget.dev); | 1840 | device_unregister(&ci->gadget.dev); |
1841 | /* my kobject is dynamic, I swear! */ | 1841 | /* my kobject is dynamic, I swear! */ |
1842 | memset(&ci->gadget, 0, sizeof(ci->gadget)); | 1842 | memset(&ci->gadget, 0, sizeof(ci->gadget)); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 8ac25adf31b4..387dc6c8ad25 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -593,7 +593,6 @@ static void acm_port_destruct(struct tty_port *port) | |||
593 | 593 | ||
594 | dev_dbg(&acm->control->dev, "%s\n", __func__); | 594 | dev_dbg(&acm->control->dev, "%s\n", __func__); |
595 | 595 | ||
596 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
597 | acm_release_minor(acm); | 596 | acm_release_minor(acm); |
598 | usb_put_intf(acm->control); | 597 | usb_put_intf(acm->control); |
599 | kfree(acm->country_codes); | 598 | kfree(acm->country_codes); |
@@ -977,6 +976,8 @@ static int acm_probe(struct usb_interface *intf, | |||
977 | int num_rx_buf; | 976 | int num_rx_buf; |
978 | int i; | 977 | int i; |
979 | int combined_interfaces = 0; | 978 | int combined_interfaces = 0; |
979 | struct device *tty_dev; | ||
980 | int rv = -ENOMEM; | ||
980 | 981 | ||
981 | /* normal quirks */ | 982 | /* normal quirks */ |
982 | quirks = (unsigned long)id->driver_info; | 983 | quirks = (unsigned long)id->driver_info; |
@@ -1339,11 +1340,24 @@ skip_countries: | |||
1339 | usb_set_intfdata(data_interface, acm); | 1340 | usb_set_intfdata(data_interface, acm); |
1340 | 1341 | ||
1341 | usb_get_intf(control_interface); | 1342 | usb_get_intf(control_interface); |
1342 | tty_port_register_device(&acm->port, acm_tty_driver, minor, | 1343 | tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, |
1343 | &control_interface->dev); | 1344 | &control_interface->dev); |
1345 | if (IS_ERR(tty_dev)) { | ||
1346 | rv = PTR_ERR(tty_dev); | ||
1347 | goto alloc_fail8; | ||
1348 | } | ||
1344 | 1349 | ||
1345 | return 0; | 1350 | return 0; |
1351 | alloc_fail8: | ||
1352 | if (acm->country_codes) { | ||
1353 | device_remove_file(&acm->control->dev, | ||
1354 | &dev_attr_wCountryCodes); | ||
1355 | device_remove_file(&acm->control->dev, | ||
1356 | &dev_attr_iCountryCodeRelDate); | ||
1357 | } | ||
1358 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | ||
1346 | alloc_fail7: | 1359 | alloc_fail7: |
1360 | usb_set_intfdata(intf, NULL); | ||
1347 | for (i = 0; i < ACM_NW; i++) | 1361 | for (i = 0; i < ACM_NW; i++) |
1348 | usb_free_urb(acm->wb[i].urb); | 1362 | usb_free_urb(acm->wb[i].urb); |
1349 | alloc_fail6: | 1363 | alloc_fail6: |
@@ -1359,7 +1373,7 @@ alloc_fail2: | |||
1359 | acm_release_minor(acm); | 1373 | acm_release_minor(acm); |
1360 | kfree(acm); | 1374 | kfree(acm); |
1361 | alloc_fail: | 1375 | alloc_fail: |
1362 | return -ENOMEM; | 1376 | return rv; |
1363 | } | 1377 | } |
1364 | 1378 | ||
1365 | static void stop_data_traffic(struct acm *acm) | 1379 | static void stop_data_traffic(struct acm *acm) |
@@ -1411,6 +1425,8 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1411 | 1425 | ||
1412 | stop_data_traffic(acm); | 1426 | stop_data_traffic(acm); |
1413 | 1427 | ||
1428 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
1429 | |||
1414 | usb_free_urb(acm->ctrlurb); | 1430 | usb_free_urb(acm->ctrlurb); |
1415 | for (i = 0; i < ACM_NW; i++) | 1431 | for (i = 0; i < ACM_NW; i++) |
1416 | usb_free_urb(acm->wb[i].urb); | 1432 | usb_free_urb(acm->wb[i].urb); |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 5f0cb417b736..122d056d96d5 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -56,6 +56,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids); | |||
56 | #define WDM_RESPONDING 7 | 56 | #define WDM_RESPONDING 7 |
57 | #define WDM_SUSPENDING 8 | 57 | #define WDM_SUSPENDING 8 |
58 | #define WDM_RESETTING 9 | 58 | #define WDM_RESETTING 9 |
59 | #define WDM_OVERFLOW 10 | ||
59 | 60 | ||
60 | #define WDM_MAX 16 | 61 | #define WDM_MAX 16 |
61 | 62 | ||
@@ -155,6 +156,7 @@ static void wdm_in_callback(struct urb *urb) | |||
155 | { | 156 | { |
156 | struct wdm_device *desc = urb->context; | 157 | struct wdm_device *desc = urb->context; |
157 | int status = urb->status; | 158 | int status = urb->status; |
159 | int length = urb->actual_length; | ||
158 | 160 | ||
159 | spin_lock(&desc->iuspin); | 161 | spin_lock(&desc->iuspin); |
160 | clear_bit(WDM_RESPONDING, &desc->flags); | 162 | clear_bit(WDM_RESPONDING, &desc->flags); |
@@ -185,9 +187,17 @@ static void wdm_in_callback(struct urb *urb) | |||
185 | } | 187 | } |
186 | 188 | ||
187 | desc->rerr = status; | 189 | desc->rerr = status; |
188 | desc->reslength = urb->actual_length; | 190 | if (length + desc->length > desc->wMaxCommand) { |
189 | memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); | 191 | /* The buffer would overflow */ |
190 | desc->length += desc->reslength; | 192 | set_bit(WDM_OVERFLOW, &desc->flags); |
193 | } else { | ||
194 | /* we may already be in overflow */ | ||
195 | if (!test_bit(WDM_OVERFLOW, &desc->flags)) { | ||
196 | memmove(desc->ubuf + desc->length, desc->inbuf, length); | ||
197 | desc->length += length; | ||
198 | desc->reslength = length; | ||
199 | } | ||
200 | } | ||
191 | skip_error: | 201 | skip_error: |
192 | wake_up(&desc->wait); | 202 | wake_up(&desc->wait); |
193 | 203 | ||
@@ -435,6 +445,11 @@ retry: | |||
435 | rv = -ENODEV; | 445 | rv = -ENODEV; |
436 | goto err; | 446 | goto err; |
437 | } | 447 | } |
448 | if (test_bit(WDM_OVERFLOW, &desc->flags)) { | ||
449 | clear_bit(WDM_OVERFLOW, &desc->flags); | ||
450 | rv = -ENOBUFS; | ||
451 | goto err; | ||
452 | } | ||
438 | i++; | 453 | i++; |
439 | if (file->f_flags & O_NONBLOCK) { | 454 | if (file->f_flags & O_NONBLOCK) { |
440 | if (!test_bit(WDM_READ, &desc->flags)) { | 455 | if (!test_bit(WDM_READ, &desc->flags)) { |
@@ -478,6 +493,7 @@ retry: | |||
478 | spin_unlock_irq(&desc->iuspin); | 493 | spin_unlock_irq(&desc->iuspin); |
479 | goto retry; | 494 | goto retry; |
480 | } | 495 | } |
496 | |||
481 | if (!desc->reslength) { /* zero length read */ | 497 | if (!desc->reslength) { /* zero length read */ |
482 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); | 498 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); |
483 | clear_bit(WDM_READ, &desc->flags); | 499 | clear_bit(WDM_READ, &desc->flags); |
@@ -1004,6 +1020,7 @@ static int wdm_post_reset(struct usb_interface *intf) | |||
1004 | struct wdm_device *desc = wdm_find_device(intf); | 1020 | struct wdm_device *desc = wdm_find_device(intf); |
1005 | int rv; | 1021 | int rv; |
1006 | 1022 | ||
1023 | clear_bit(WDM_OVERFLOW, &desc->flags); | ||
1007 | clear_bit(WDM_RESETTING, &desc->flags); | 1024 | clear_bit(WDM_RESETTING, &desc->flags); |
1008 | rv = recover_from_urb_loss(desc); | 1025 | rv = recover_from_urb_loss(desc); |
1009 | mutex_unlock(&desc->wlock); | 1026 | mutex_unlock(&desc->wlock); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..2b487d4797bd 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
173 | struct hc_driver *driver; | 173 | struct hc_driver *driver; |
174 | struct usb_hcd *hcd; | 174 | struct usb_hcd *hcd; |
175 | int retval; | 175 | int retval; |
176 | int hcd_irq = 0; | ||
176 | 177 | ||
177 | if (usb_disabled()) | 178 | if (usb_disabled()) |
178 | return -ENODEV; | 179 | return -ENODEV; |
@@ -187,15 +188,19 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
187 | return -ENODEV; | 188 | return -ENODEV; |
188 | dev->current_state = PCI_D0; | 189 | dev->current_state = PCI_D0; |
189 | 190 | ||
190 | /* The xHCI driver supports MSI and MSI-X, | 191 | /* |
191 | * so don't fail if the BIOS doesn't provide a legacy IRQ. | 192 | * The xHCI driver has its own irq management |
193 | * make sure irq setup is not touched for xhci in generic hcd code | ||
192 | */ | 194 | */ |
193 | if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) { | 195 | if ((driver->flags & HCD_MASK) != HCD_USB3) { |
194 | dev_err(&dev->dev, | 196 | if (!dev->irq) { |
195 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", | 197 | dev_err(&dev->dev, |
196 | pci_name(dev)); | 198 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
197 | retval = -ENODEV; | 199 | pci_name(dev)); |
198 | goto disable_pci; | 200 | retval = -ENODEV; |
201 | goto disable_pci; | ||
202 | } | ||
203 | hcd_irq = dev->irq; | ||
199 | } | 204 | } |
200 | 205 | ||
201 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); | 206 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
@@ -245,7 +250,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
245 | 250 | ||
246 | pci_set_master(dev); | 251 | pci_set_master(dev); |
247 | 252 | ||
248 | retval = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); | 253 | retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); |
249 | if (retval != 0) | 254 | if (retval != 0) |
250 | goto unmap_registers; | 255 | goto unmap_registers; |
251 | set_hs_companion(dev, hcd); | 256 | set_hs_companion(dev, hcd); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 99b34a30354f..f9ec44cbb82f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -2412,6 +2412,14 @@ int usb_hcd_is_primary_hcd(struct usb_hcd *hcd) | |||
2412 | } | 2412 | } |
2413 | EXPORT_SYMBOL_GPL(usb_hcd_is_primary_hcd); | 2413 | EXPORT_SYMBOL_GPL(usb_hcd_is_primary_hcd); |
2414 | 2414 | ||
2415 | int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1) | ||
2416 | { | ||
2417 | if (!hcd->driver->find_raw_port_number) | ||
2418 | return port1; | ||
2419 | |||
2420 | return hcd->driver->find_raw_port_number(hcd, port1); | ||
2421 | } | ||
2422 | |||
2415 | static int usb_hcd_request_irqs(struct usb_hcd *hcd, | 2423 | static int usb_hcd_request_irqs(struct usb_hcd *hcd, |
2416 | unsigned int irqnum, unsigned long irqflags) | 2424 | unsigned int irqnum, unsigned long irqflags) |
2417 | { | 2425 | { |
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 797f9d514732..65d4e55552c6 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -67,7 +67,6 @@ static void usb_port_device_release(struct device *dev) | |||
67 | { | 67 | { |
68 | struct usb_port *port_dev = to_usb_port(dev); | 68 | struct usb_port *port_dev = to_usb_port(dev); |
69 | 69 | ||
70 | dev_pm_qos_hide_flags(dev); | ||
71 | kfree(port_dev); | 70 | kfree(port_dev); |
72 | } | 71 | } |
73 | 72 | ||
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index b6f4bad3f756..255c14464bf2 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/acpi.h> | 16 | #include <linux/acpi.h> |
17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
18 | #include <linux/usb/hcd.h> | ||
18 | #include <acpi/acpi_bus.h> | 19 | #include <acpi/acpi_bus.h> |
19 | 20 | ||
20 | #include "usb.h" | 21 | #include "usb.h" |
@@ -188,8 +189,13 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle) | |||
188 | * connected to. | 189 | * connected to. |
189 | */ | 190 | */ |
190 | if (!udev->parent) { | 191 | if (!udev->parent) { |
191 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), | 192 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); |
193 | int raw_port_num; | ||
194 | |||
195 | raw_port_num = usb_hcd_find_raw_port_number(hcd, | ||
192 | port_num); | 196 | port_num); |
197 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), | ||
198 | raw_port_num); | ||
193 | if (!*handle) | 199 | if (!*handle) |
194 | return -ENODEV; | 200 | return -ENODEV; |
195 | } else { | 201 | } else { |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 999909451e37..ffa6b004a84b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -583,6 +583,7 @@ static int dwc3_remove(struct platform_device *pdev) | |||
583 | break; | 583 | break; |
584 | } | 584 | } |
585 | 585 | ||
586 | dwc3_free_event_buffers(dwc); | ||
586 | dwc3_core_exit(dwc); | 587 | dwc3_core_exit(dwc); |
587 | 588 | ||
588 | return 0; | 589 | return 0; |
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index b50da53e9a52..b082bec7343e 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/usb/nop-usb-xceiv.h> | 23 | #include <linux/usb/nop-usb-xceiv.h> |
24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
25 | 25 | ||
26 | #include "core.h" | ||
27 | |||
28 | struct dwc3_exynos { | 26 | struct dwc3_exynos { |
29 | struct platform_device *dwc3; | 27 | struct platform_device *dwc3; |
30 | struct platform_device *usb2_phy; | 28 | struct platform_device *usb2_phy; |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 22f337f57219..afa05e3c9cf4 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -54,8 +54,6 @@ | |||
54 | #include <linux/usb/otg.h> | 54 | #include <linux/usb/otg.h> |
55 | #include <linux/usb/nop-usb-xceiv.h> | 55 | #include <linux/usb/nop-usb-xceiv.h> |
56 | 56 | ||
57 | #include "core.h" | ||
58 | |||
59 | /* | 57 | /* |
60 | * All these registers belong to OMAP's Wrapper around the | 58 | * All these registers belong to OMAP's Wrapper around the |
61 | * DesignWare USB3 Core. | 59 | * DesignWare USB3 Core. |
@@ -465,20 +463,20 @@ static int dwc3_omap_remove(struct platform_device *pdev) | |||
465 | return 0; | 463 | return 0; |
466 | } | 464 | } |
467 | 465 | ||
468 | static const struct of_device_id of_dwc3_matach[] = { | 466 | static const struct of_device_id of_dwc3_match[] = { |
469 | { | 467 | { |
470 | "ti,dwc3", | 468 | "ti,dwc3", |
471 | }, | 469 | }, |
472 | { }, | 470 | { }, |
473 | }; | 471 | }; |
474 | MODULE_DEVICE_TABLE(of, of_dwc3_matach); | 472 | MODULE_DEVICE_TABLE(of, of_dwc3_match); |
475 | 473 | ||
476 | static struct platform_driver dwc3_omap_driver = { | 474 | static struct platform_driver dwc3_omap_driver = { |
477 | .probe = dwc3_omap_probe, | 475 | .probe = dwc3_omap_probe, |
478 | .remove = dwc3_omap_remove, | 476 | .remove = dwc3_omap_remove, |
479 | .driver = { | 477 | .driver = { |
480 | .name = "omap-dwc3", | 478 | .name = "omap-dwc3", |
481 | .of_match_table = of_dwc3_matach, | 479 | .of_match_table = of_dwc3_match, |
482 | }, | 480 | }, |
483 | }; | 481 | }; |
484 | 482 | ||
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 7d70f44567d2..e8d77689a322 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -45,8 +45,6 @@ | |||
45 | #include <linux/usb/otg.h> | 45 | #include <linux/usb/otg.h> |
46 | #include <linux/usb/nop-usb-xceiv.h> | 46 | #include <linux/usb/nop-usb-xceiv.h> |
47 | 47 | ||
48 | #include "core.h" | ||
49 | |||
50 | /* FIXME define these in <linux/pci_ids.h> */ | 48 | /* FIXME define these in <linux/pci_ids.h> */ |
51 | #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 | 49 | #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 |
52 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd | 50 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index d7da073a23fe..1d139ca05ef1 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -891,7 +891,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
891 | DWC3_TRBCTL_CONTROL_DATA); | 891 | DWC3_TRBCTL_CONTROL_DATA); |
892 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) | 892 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) |
893 | && (dep->number == 0)) { | 893 | && (dep->number == 0)) { |
894 | u32 transfer_size; | 894 | u32 transfer_size; |
895 | u32 maxpacket; | ||
895 | 896 | ||
896 | ret = usb_gadget_map_request(&dwc->gadget, &req->request, | 897 | ret = usb_gadget_map_request(&dwc->gadget, &req->request, |
897 | dep->number); | 898 | dep->number); |
@@ -902,8 +903,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
902 | 903 | ||
903 | WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE); | 904 | WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE); |
904 | 905 | ||
905 | transfer_size = roundup(req->request.length, | 906 | maxpacket = dep->endpoint.maxpacket; |
906 | (u32) dep->endpoint.maxpacket); | 907 | transfer_size = roundup(req->request.length, maxpacket); |
907 | 908 | ||
908 | dwc->ep0_bounced = true; | 909 | dwc->ep0_bounced = true; |
909 | 910 | ||
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a04342f6cbfa..82e160e96fca 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -2159,7 +2159,6 @@ static void dwc3_gadget_phy_suspend(struct dwc3 *dwc, u8 speed) | |||
2159 | 2159 | ||
2160 | static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) | 2160 | static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) |
2161 | { | 2161 | { |
2162 | struct dwc3_gadget_ep_cmd_params params; | ||
2163 | struct dwc3_ep *dep; | 2162 | struct dwc3_ep *dep; |
2164 | int ret; | 2163 | int ret; |
2165 | u32 reg; | 2164 | u32 reg; |
@@ -2167,8 +2166,6 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) | |||
2167 | 2166 | ||
2168 | dev_vdbg(dwc->dev, "%s\n", __func__); | 2167 | dev_vdbg(dwc->dev, "%s\n", __func__); |
2169 | 2168 | ||
2170 | memset(¶ms, 0x00, sizeof(params)); | ||
2171 | |||
2172 | reg = dwc3_readl(dwc->regs, DWC3_DSTS); | 2169 | reg = dwc3_readl(dwc->regs, DWC3_DSTS); |
2173 | speed = reg & DWC3_DSTS_CONNECTSPD; | 2170 | speed = reg & DWC3_DSTS_CONNECTSPD; |
2174 | dwc->speed = speed; | 2171 | dwc->speed = speed; |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 5a0c541daf89..c7525b1cad74 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -145,6 +145,7 @@ config USB_LPC32XX | |||
145 | tristate "LPC32XX USB Peripheral Controller" | 145 | tristate "LPC32XX USB Peripheral Controller" |
146 | depends on ARCH_LPC32XX | 146 | depends on ARCH_LPC32XX |
147 | select USB_ISP1301 | 147 | select USB_ISP1301 |
148 | select USB_OTG_UTILS | ||
148 | help | 149 | help |
149 | This option selects the USB device controller in the LPC32xx SoC. | 150 | This option selects the USB device controller in the LPC32xx SoC. |
150 | 151 | ||
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 97a13c349cc5..82fb22511356 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile | |||
@@ -35,6 +35,12 @@ mv_udc-y := mv_udc_core.o | |||
35 | obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o | 35 | obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o |
36 | obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o | 36 | obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o |
37 | 37 | ||
38 | # USB Functions | ||
39 | obj-$(CONFIG_USB_F_ACM) += f_acm.o | ||
40 | f_ss_lb-y := f_loopback.o f_sourcesink.o | ||
41 | obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o | ||
42 | obj-$(CONFIG_USB_U_SERIAL) += u_serial.o | ||
43 | |||
38 | # | 44 | # |
39 | # USB gadget drivers | 45 | # USB gadget drivers |
40 | # | 46 | # |
@@ -74,9 +80,3 @@ obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o | |||
74 | obj-$(CONFIG_USB_G_NCM) += g_ncm.o | 80 | obj-$(CONFIG_USB_G_NCM) += g_ncm.o |
75 | obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o | 81 | obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o |
76 | obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o | 82 | obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o |
77 | |||
78 | # USB Functions | ||
79 | obj-$(CONFIG_USB_F_ACM) += f_acm.o | ||
80 | f_ss_lb-y := f_loopback.o f_sourcesink.o | ||
81 | obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o | ||
82 | obj-$(CONFIG_USB_U_SERIAL) += u_serial.o | ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 7c821de8ce3d..c0d62b278610 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -1757,10 +1757,7 @@ static const struct usb_gadget_driver composite_driver_template = { | |||
1757 | /** | 1757 | /** |
1758 | * usb_composite_probe() - register a composite driver | 1758 | * usb_composite_probe() - register a composite driver |
1759 | * @driver: the driver to register | 1759 | * @driver: the driver to register |
1760 | * @bind: the callback used to allocate resources that are shared across the | 1760 | * |
1761 | * whole device, such as string IDs, and add its configurations using | ||
1762 | * @usb_add_config(). This may fail by returning a negative errno | ||
1763 | * value; it should return zero on successful initialization. | ||
1764 | * Context: single threaded during gadget setup | 1761 | * Context: single threaded during gadget setup |
1765 | * | 1762 | * |
1766 | * This function is used to register drivers using the composite driver | 1763 | * This function is used to register drivers using the composite driver |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 71beeb833558..cc9c49c57c80 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -447,14 +447,13 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req) | |||
447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) | 447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) |
448 | { | 448 | { |
449 | struct f_rndis *rndis = req->context; | 449 | struct f_rndis *rndis = req->context; |
450 | struct usb_composite_dev *cdev = rndis->port.func.config->cdev; | ||
451 | int status; | 450 | int status; |
452 | 451 | ||
453 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ | 452 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ |
454 | // spin_lock(&dev->lock); | 453 | // spin_lock(&dev->lock); |
455 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); | 454 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); |
456 | if (status < 0) | 455 | if (status < 0) |
457 | ERROR(cdev, "RNDIS command error %d, %d/%d\n", | 456 | pr_err("RNDIS command error %d, %d/%d\n", |
458 | status, req->actual, req->length); | 457 | status, req->actual, req->length); |
459 | // spin_unlock(&dev->lock); | 458 | // spin_unlock(&dev->lock); |
460 | } | 459 | } |
diff --git a/drivers/usb/gadget/f_uac1.c b/drivers/usb/gadget/f_uac1.c index f570e667a640..fa8ea4ea00c1 100644 --- a/drivers/usb/gadget/f_uac1.c +++ b/drivers/usb/gadget/f_uac1.c | |||
@@ -418,6 +418,7 @@ static int audio_get_intf_req(struct usb_function *f, | |||
418 | 418 | ||
419 | req->context = audio; | 419 | req->context = audio; |
420 | req->complete = f_audio_complete; | 420 | req->complete = f_audio_complete; |
421 | len = min_t(size_t, sizeof(value), len); | ||
421 | memcpy(req->buf, &value, len); | 422 | memcpy(req->buf, &value, len); |
422 | 423 | ||
423 | return len; | 424 | return len; |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 3953dd4d7186..3b343b23e4b0 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -357,7 +357,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
357 | goto error; | 357 | goto error; |
358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; | 358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; |
359 | 359 | ||
360 | for (i = func_num; --i; ) { | 360 | for (i = func_num; i--; ) { |
361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); | 361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); |
362 | if (unlikely(ret < 0)) { | 362 | if (unlikely(ret < 0)) { |
363 | while (++i < func_num) | 363 | while (++i < func_num) |
@@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev) | |||
413 | gether_cleanup(); | 413 | gether_cleanup(); |
414 | gfs_ether_setup = false; | 414 | gfs_ether_setup = false; |
415 | 415 | ||
416 | for (i = func_num; --i; ) | 416 | for (i = func_num; i--; ) |
417 | if (ffs_tab[i].ffs_data) | 417 | if (ffs_tab[i].ffs_data) |
418 | functionfs_unbind(ffs_tab[i].ffs_data); | 418 | functionfs_unbind(ffs_tab[i].ffs_data); |
419 | 419 | ||
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index 8efd7555fa21..5bd930d779b9 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
@@ -1334,27 +1334,18 @@ static int imx_udc_start(struct usb_gadget *gadget, | |||
1334 | struct usb_gadget_driver *driver) | 1334 | struct usb_gadget_driver *driver) |
1335 | { | 1335 | { |
1336 | struct imx_udc_struct *imx_usb; | 1336 | struct imx_udc_struct *imx_usb; |
1337 | int retval; | ||
1338 | 1337 | ||
1339 | imx_usb = container_of(gadget, struct imx_udc_struct, gadget); | 1338 | imx_usb = container_of(gadget, struct imx_udc_struct, gadget); |
1340 | /* first hook up the driver ... */ | 1339 | /* first hook up the driver ... */ |
1341 | imx_usb->driver = driver; | 1340 | imx_usb->driver = driver; |
1342 | imx_usb->gadget.dev.driver = &driver->driver; | 1341 | imx_usb->gadget.dev.driver = &driver->driver; |
1343 | 1342 | ||
1344 | retval = device_add(&imx_usb->gadget.dev); | ||
1345 | if (retval) | ||
1346 | goto fail; | ||
1347 | |||
1348 | D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", | 1343 | D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", |
1349 | __func__, driver->driver.name); | 1344 | __func__, driver->driver.name); |
1350 | 1345 | ||
1351 | imx_udc_enable(imx_usb); | 1346 | imx_udc_enable(imx_usb); |
1352 | 1347 | ||
1353 | return 0; | 1348 | return 0; |
1354 | fail: | ||
1355 | imx_usb->driver = NULL; | ||
1356 | imx_usb->gadget.dev.driver = NULL; | ||
1357 | return retval; | ||
1358 | } | 1349 | } |
1359 | 1350 | ||
1360 | static int imx_udc_stop(struct usb_gadget *gadget, | 1351 | static int imx_udc_stop(struct usb_gadget *gadget, |
@@ -1370,8 +1361,6 @@ static int imx_udc_stop(struct usb_gadget *gadget, | |||
1370 | imx_usb->gadget.dev.driver = NULL; | 1361 | imx_usb->gadget.dev.driver = NULL; |
1371 | imx_usb->driver = NULL; | 1362 | imx_usb->driver = NULL; |
1372 | 1363 | ||
1373 | device_del(&imx_usb->gadget.dev); | ||
1374 | |||
1375 | D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n", | 1364 | D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n", |
1376 | __func__, driver->driver.name); | 1365 | __func__, driver->driver.name); |
1377 | 1366 | ||
@@ -1477,6 +1466,10 @@ static int __init imx_udc_probe(struct platform_device *pdev) | |||
1477 | imx_usb->gadget.dev.parent = &pdev->dev; | 1466 | imx_usb->gadget.dev.parent = &pdev->dev; |
1478 | imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask; | 1467 | imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask; |
1479 | 1468 | ||
1469 | ret = device_add(&imx_usb->gadget.dev); | ||
1470 | if (retval) | ||
1471 | goto fail4; | ||
1472 | |||
1480 | platform_set_drvdata(pdev, imx_usb); | 1473 | platform_set_drvdata(pdev, imx_usb); |
1481 | 1474 | ||
1482 | usb_init_data(imx_usb); | 1475 | usb_init_data(imx_usb); |
@@ -1488,9 +1481,11 @@ static int __init imx_udc_probe(struct platform_device *pdev) | |||
1488 | 1481 | ||
1489 | ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); | 1482 | ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); |
1490 | if (ret) | 1483 | if (ret) |
1491 | goto fail4; | 1484 | goto fail5; |
1492 | 1485 | ||
1493 | return 0; | 1486 | return 0; |
1487 | fail5: | ||
1488 | device_unregister(&imx_usb->gadget.dev); | ||
1494 | fail4: | 1489 | fail4: |
1495 | for (i = 0; i < IMX_USB_NB_EP + 1; i++) | 1490 | for (i = 0; i < IMX_USB_NB_EP + 1; i++) |
1496 | free_irq(imx_usb->usbd_int[i], imx_usb); | 1491 | free_irq(imx_usb->usbd_int[i], imx_usb); |
@@ -1514,6 +1509,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev) | |||
1514 | int i; | 1509 | int i; |
1515 | 1510 | ||
1516 | usb_del_gadget_udc(&imx_usb->gadget); | 1511 | usb_del_gadget_udc(&imx_usb->gadget); |
1512 | device_unregister(&imx_usb->gadget.dev); | ||
1517 | imx_udc_disable(imx_usb); | 1513 | imx_udc_disable(imx_usb); |
1518 | del_timer(&imx_usb->timer); | 1514 | del_timer(&imx_usb->timer); |
1519 | 1515 | ||
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index d226058e3b88..32524b631959 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -59,7 +59,7 @@ static const char * const ep_name[] = { | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | 61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) |
62 | #ifdef CONFIG_USB_GADGET_NET2272_DMA | 62 | #ifdef CONFIG_USB_NET2272_DMA |
63 | /* | 63 | /* |
64 | * use_dma: the NET2272 can use an external DMA controller. | 64 | * use_dma: the NET2272 can use an external DMA controller. |
65 | * Note that since there is no generic DMA api, some functions, | 65 | * Note that since there is no generic DMA api, some functions, |
@@ -1495,6 +1495,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) | |||
1495 | for (i = 0; i < 4; ++i) | 1495 | for (i = 0; i < 4; ++i) |
1496 | net2272_dequeue_all(&dev->ep[i]); | 1496 | net2272_dequeue_all(&dev->ep[i]); |
1497 | 1497 | ||
1498 | /* report disconnect; the driver is already quiesced */ | ||
1499 | if (driver) { | ||
1500 | spin_unlock(&dev->lock); | ||
1501 | driver->disconnect(&dev->gadget); | ||
1502 | spin_lock(&dev->lock); | ||
1503 | } | ||
1504 | |||
1498 | net2272_usb_reinit(dev); | 1505 | net2272_usb_reinit(dev); |
1499 | } | 1506 | } |
1500 | 1507 | ||
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index a1b650e11339..3bd0f992fb49 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -1924,7 +1924,6 @@ static int net2280_start(struct usb_gadget *_gadget, | |||
1924 | err_func: | 1924 | err_func: |
1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); | 1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); |
1926 | err_unbind: | 1926 | err_unbind: |
1927 | driver->unbind (&dev->gadget); | ||
1928 | dev->gadget.dev.driver = NULL; | 1927 | dev->gadget.dev.driver = NULL; |
1929 | dev->driver = NULL; | 1928 | dev->driver = NULL; |
1930 | return retval; | 1929 | return retval; |
@@ -1946,6 +1945,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) | |||
1946 | for (i = 0; i < 7; i++) | 1945 | for (i = 0; i < 7; i++) |
1947 | nuke (&dev->ep [i]); | 1946 | nuke (&dev->ep [i]); |
1948 | 1947 | ||
1948 | /* report disconnect; the driver is already quiesced */ | ||
1949 | if (driver) { | ||
1950 | spin_unlock(&dev->lock); | ||
1951 | driver->disconnect(&dev->gadget); | ||
1952 | spin_lock(&dev->lock); | ||
1953 | } | ||
1954 | |||
1949 | usb_reinit (dev); | 1955 | usb_reinit (dev); |
1950 | } | 1956 | } |
1951 | 1957 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 06be85c2b233..f8445653577f 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #define DRIVER_VERSION "4 October 2004" | 62 | #define DRIVER_VERSION "4 October 2004" |
63 | 63 | ||
64 | #define OMAP_DMA_USB_W2FC_TX0 29 | 64 | #define OMAP_DMA_USB_W2FC_TX0 29 |
65 | #define OMAP_DMA_USB_W2FC_RX0 26 | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * The OMAP UDC needs _very_ early endpoint setup: before enabling the | 68 | * The OMAP UDC needs _very_ early endpoint setup: before enabling the |
@@ -1310,7 +1311,7 @@ static int omap_pullup(struct usb_gadget *gadget, int is_on) | |||
1310 | } | 1311 | } |
1311 | 1312 | ||
1312 | static int omap_udc_start(struct usb_gadget *g, | 1313 | static int omap_udc_start(struct usb_gadget *g, |
1313 | struct usb_gadget_driver *driver) | 1314 | struct usb_gadget_driver *driver); |
1314 | static int omap_udc_stop(struct usb_gadget *g, | 1315 | static int omap_udc_stop(struct usb_gadget *g, |
1315 | struct usb_gadget_driver *driver); | 1316 | struct usb_gadget_driver *driver); |
1316 | 1317 | ||
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 2bbcdce942dc..d0f37484b6b0 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -1266,13 +1266,6 @@ static int pxa25x_udc_start(struct usb_gadget *g, | |||
1266 | dev->gadget.dev.driver = &driver->driver; | 1266 | dev->gadget.dev.driver = &driver->driver; |
1267 | dev->pullup = 1; | 1267 | dev->pullup = 1; |
1268 | 1268 | ||
1269 | retval = device_add (&dev->gadget.dev); | ||
1270 | if (retval) { | ||
1271 | dev->driver = NULL; | ||
1272 | dev->gadget.dev.driver = NULL; | ||
1273 | return retval; | ||
1274 | } | ||
1275 | |||
1276 | /* ... then enable host detection and ep0; and we're ready | 1269 | /* ... then enable host detection and ep0; and we're ready |
1277 | * for set_configuration as well as eventual disconnect. | 1270 | * for set_configuration as well as eventual disconnect. |
1278 | */ | 1271 | */ |
@@ -1310,6 +1303,10 @@ stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) | |||
1310 | } | 1303 | } |
1311 | del_timer_sync(&dev->timer); | 1304 | del_timer_sync(&dev->timer); |
1312 | 1305 | ||
1306 | /* report disconnect; the driver is already quiesced */ | ||
1307 | if (driver) | ||
1308 | driver->disconnect(&dev->gadget); | ||
1309 | |||
1313 | /* re-init driver-visible data structures */ | 1310 | /* re-init driver-visible data structures */ |
1314 | udc_reinit(dev); | 1311 | udc_reinit(dev); |
1315 | } | 1312 | } |
@@ -1331,7 +1328,6 @@ static int pxa25x_udc_stop(struct usb_gadget*g, | |||
1331 | dev->gadget.dev.driver = NULL; | 1328 | dev->gadget.dev.driver = NULL; |
1332 | dev->driver = NULL; | 1329 | dev->driver = NULL; |
1333 | 1330 | ||
1334 | device_del (&dev->gadget.dev); | ||
1335 | dump_state(dev); | 1331 | dump_state(dev); |
1336 | 1332 | ||
1337 | return 0; | 1333 | return 0; |
@@ -2146,6 +2142,13 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2146 | dev->gadget.dev.parent = &pdev->dev; | 2142 | dev->gadget.dev.parent = &pdev->dev; |
2147 | dev->gadget.dev.dma_mask = pdev->dev.dma_mask; | 2143 | dev->gadget.dev.dma_mask = pdev->dev.dma_mask; |
2148 | 2144 | ||
2145 | retval = device_add(&dev->gadget.dev); | ||
2146 | if (retval) { | ||
2147 | dev->driver = NULL; | ||
2148 | dev->gadget.dev.driver = NULL; | ||
2149 | goto err_device_add; | ||
2150 | } | ||
2151 | |||
2149 | the_controller = dev; | 2152 | the_controller = dev; |
2150 | platform_set_drvdata(pdev, dev); | 2153 | platform_set_drvdata(pdev, dev); |
2151 | 2154 | ||
@@ -2196,6 +2199,8 @@ lubbock_fail0: | |||
2196 | free_irq(irq, dev); | 2199 | free_irq(irq, dev); |
2197 | #endif | 2200 | #endif |
2198 | err_irq1: | 2201 | err_irq1: |
2202 | device_unregister(&dev->gadget.dev); | ||
2203 | err_device_add: | ||
2199 | if (gpio_is_valid(dev->mach->gpio_pullup)) | 2204 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2200 | gpio_free(dev->mach->gpio_pullup); | 2205 | gpio_free(dev->mach->gpio_pullup); |
2201 | err_gpio_pullup: | 2206 | err_gpio_pullup: |
@@ -2217,10 +2222,11 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2217 | { | 2222 | { |
2218 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); | 2223 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); |
2219 | 2224 | ||
2220 | usb_del_gadget_udc(&dev->gadget); | ||
2221 | if (dev->driver) | 2225 | if (dev->driver) |
2222 | return -EBUSY; | 2226 | return -EBUSY; |
2223 | 2227 | ||
2228 | usb_del_gadget_udc(&dev->gadget); | ||
2229 | device_unregister(&dev->gadget.dev); | ||
2224 | dev->pullup = 0; | 2230 | dev->pullup = 0; |
2225 | pullup(dev); | 2231 | pullup(dev); |
2226 | 2232 | ||
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index f7d25795821a..2fc867652ef5 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1814,11 +1814,6 @@ static int pxa27x_udc_start(struct usb_gadget *g, | |||
1814 | udc->gadget.dev.driver = &driver->driver; | 1814 | udc->gadget.dev.driver = &driver->driver; |
1815 | dplus_pullup(udc, 1); | 1815 | dplus_pullup(udc, 1); |
1816 | 1816 | ||
1817 | retval = device_add(&udc->gadget.dev); | ||
1818 | if (retval) { | ||
1819 | dev_err(udc->dev, "device_add error %d\n", retval); | ||
1820 | goto fail; | ||
1821 | } | ||
1822 | if (!IS_ERR_OR_NULL(udc->transceiver)) { | 1817 | if (!IS_ERR_OR_NULL(udc->transceiver)) { |
1823 | retval = otg_set_peripheral(udc->transceiver->otg, | 1818 | retval = otg_set_peripheral(udc->transceiver->otg, |
1824 | &udc->gadget); | 1819 | &udc->gadget); |
@@ -1876,7 +1871,6 @@ static int pxa27x_udc_stop(struct usb_gadget *g, | |||
1876 | 1871 | ||
1877 | udc->driver = NULL; | 1872 | udc->driver = NULL; |
1878 | 1873 | ||
1879 | device_del(&udc->gadget.dev); | ||
1880 | 1874 | ||
1881 | if (!IS_ERR_OR_NULL(udc->transceiver)) | 1875 | if (!IS_ERR_OR_NULL(udc->transceiver)) |
1882 | return otg_set_peripheral(udc->transceiver->otg, NULL); | 1876 | return otg_set_peripheral(udc->transceiver->otg, NULL); |
@@ -2480,13 +2474,24 @@ static int __init pxa_udc_probe(struct platform_device *pdev) | |||
2480 | driver_name, udc->irq, retval); | 2474 | driver_name, udc->irq, retval); |
2481 | goto err_irq; | 2475 | goto err_irq; |
2482 | } | 2476 | } |
2477 | |||
2478 | retval = device_add(&udc->gadget.dev); | ||
2479 | if (retval) { | ||
2480 | dev_err(udc->dev, "device_add error %d\n", retval); | ||
2481 | goto err_dev_add; | ||
2482 | } | ||
2483 | |||
2483 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); | 2484 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); |
2484 | if (retval) | 2485 | if (retval) |
2485 | goto err_add_udc; | 2486 | goto err_add_udc; |
2486 | 2487 | ||
2487 | pxa_init_debugfs(udc); | 2488 | pxa_init_debugfs(udc); |
2489 | |||
2488 | return 0; | 2490 | return 0; |
2491 | |||
2489 | err_add_udc: | 2492 | err_add_udc: |
2493 | device_unregister(&udc->gadget.dev); | ||
2494 | err_dev_add: | ||
2490 | free_irq(udc->irq, udc); | 2495 | free_irq(udc->irq, udc); |
2491 | err_irq: | 2496 | err_irq: |
2492 | iounmap(udc->regs); | 2497 | iounmap(udc->regs); |
@@ -2507,6 +2512,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev) | |||
2507 | int gpio = udc->mach->gpio_pullup; | 2512 | int gpio = udc->mach->gpio_pullup; |
2508 | 2513 | ||
2509 | usb_del_gadget_udc(&udc->gadget); | 2514 | usb_del_gadget_udc(&udc->gadget); |
2515 | device_del(&udc->gadget.dev); | ||
2510 | usb_gadget_unregister_driver(udc->driver); | 2516 | usb_gadget_unregister_driver(udc->driver); |
2511 | free_irq(udc->irq, udc); | 2517 | free_irq(udc->irq, udc); |
2512 | pxa_cleanup_debugfs(udc); | 2518 | pxa_cleanup_debugfs(udc); |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index fc07b4381286..08f89652533b 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1668,8 +1668,7 @@ static void s3c2410_udc_enable(struct s3c2410_udc *dev) | |||
1668 | static int s3c2410_udc_start(struct usb_gadget *g, | 1668 | static int s3c2410_udc_start(struct usb_gadget *g, |
1669 | struct usb_gadget_driver *driver) | 1669 | struct usb_gadget_driver *driver) |
1670 | { | 1670 | { |
1671 | struct s3c2410_udc *udc = to_s3c2410(g) | 1671 | struct s3c2410_udc *udc = to_s3c2410(g); |
1672 | int retval; | ||
1673 | 1672 | ||
1674 | dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name); | 1673 | dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name); |
1675 | 1674 | ||
@@ -1677,22 +1676,10 @@ static int s3c2410_udc_start(struct usb_gadget *g, | |||
1677 | udc->driver = driver; | 1676 | udc->driver = driver; |
1678 | udc->gadget.dev.driver = &driver->driver; | 1677 | udc->gadget.dev.driver = &driver->driver; |
1679 | 1678 | ||
1680 | /* Bind the driver */ | ||
1681 | retval = device_add(&udc->gadget.dev); | ||
1682 | if (retval) { | ||
1683 | dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval); | ||
1684 | goto register_error; | ||
1685 | } | ||
1686 | |||
1687 | /* Enable udc */ | 1679 | /* Enable udc */ |
1688 | s3c2410_udc_enable(udc); | 1680 | s3c2410_udc_enable(udc); |
1689 | 1681 | ||
1690 | return 0; | 1682 | return 0; |
1691 | |||
1692 | register_error: | ||
1693 | udc->driver = NULL; | ||
1694 | udc->gadget.dev.driver = NULL; | ||
1695 | return retval; | ||
1696 | } | 1683 | } |
1697 | 1684 | ||
1698 | static int s3c2410_udc_stop(struct usb_gadget *g, | 1685 | static int s3c2410_udc_stop(struct usb_gadget *g, |
@@ -1700,7 +1687,6 @@ static int s3c2410_udc_stop(struct usb_gadget *g, | |||
1700 | { | 1687 | { |
1701 | struct s3c2410_udc *udc = to_s3c2410(g); | 1688 | struct s3c2410_udc *udc = to_s3c2410(g); |
1702 | 1689 | ||
1703 | device_del(&udc->gadget.dev); | ||
1704 | udc->driver = NULL; | 1690 | udc->driver = NULL; |
1705 | 1691 | ||
1706 | /* Disable udc */ | 1692 | /* Disable udc */ |
@@ -1842,6 +1828,13 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1842 | udc->gadget.dev.parent = &pdev->dev; | 1828 | udc->gadget.dev.parent = &pdev->dev; |
1843 | udc->gadget.dev.dma_mask = pdev->dev.dma_mask; | 1829 | udc->gadget.dev.dma_mask = pdev->dev.dma_mask; |
1844 | 1830 | ||
1831 | /* Bind the driver */ | ||
1832 | retval = device_add(&udc->gadget.dev); | ||
1833 | if (retval) { | ||
1834 | dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval); | ||
1835 | goto err_device_add; | ||
1836 | } | ||
1837 | |||
1845 | the_controller = udc; | 1838 | the_controller = udc; |
1846 | platform_set_drvdata(pdev, udc); | 1839 | platform_set_drvdata(pdev, udc); |
1847 | 1840 | ||
@@ -1930,6 +1923,8 @@ err_gpio_claim: | |||
1930 | err_int: | 1923 | err_int: |
1931 | free_irq(IRQ_USBD, udc); | 1924 | free_irq(IRQ_USBD, udc); |
1932 | err_map: | 1925 | err_map: |
1926 | device_unregister(&udc->gadget.dev); | ||
1927 | err_device_add: | ||
1933 | iounmap(base_addr); | 1928 | iounmap(base_addr); |
1934 | err_mem: | 1929 | err_mem: |
1935 | release_mem_region(rsrc_start, rsrc_len); | 1930 | release_mem_region(rsrc_start, rsrc_len); |
@@ -1947,10 +1942,11 @@ static int s3c2410_udc_remove(struct platform_device *pdev) | |||
1947 | 1942 | ||
1948 | dev_dbg(&pdev->dev, "%s()\n", __func__); | 1943 | dev_dbg(&pdev->dev, "%s()\n", __func__); |
1949 | 1944 | ||
1950 | usb_del_gadget_udc(&udc->gadget); | ||
1951 | if (udc->driver) | 1945 | if (udc->driver) |
1952 | return -EBUSY; | 1946 | return -EBUSY; |
1953 | 1947 | ||
1948 | usb_del_gadget_udc(&udc->gadget); | ||
1949 | device_unregister(&udc->gadget.dev); | ||
1954 | debugfs_remove(udc->regs_info); | 1950 | debugfs_remove(udc->regs_info); |
1955 | 1951 | ||
1956 | if (udc_info && !udc_info->udc_command && | 1952 | if (udc_info && !udc_info->udc_command && |
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index c5034d9c946b..b369292d4b90 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
@@ -136,7 +136,7 @@ static struct portmaster { | |||
136 | pr_debug(fmt, ##arg) | 136 | pr_debug(fmt, ##arg) |
137 | #endif /* pr_vdebug */ | 137 | #endif /* pr_vdebug */ |
138 | #else | 138 | #else |
139 | #ifndef pr_vdebig | 139 | #ifndef pr_vdebug |
140 | #define pr_vdebug(fmt, arg...) \ | 140 | #define pr_vdebug(fmt, arg...) \ |
141 | ({ if (0) pr_debug(fmt, ##arg); }) | 141 | ({ if (0) pr_debug(fmt, ##arg); }) |
142 | #endif /* pr_vdebug */ | 142 | #endif /* pr_vdebug */ |
diff --git a/drivers/usb/gadget/u_uac1.c b/drivers/usb/gadget/u_uac1.c index e0c5e88e03ed..c7d460f43390 100644 --- a/drivers/usb/gadget/u_uac1.c +++ b/drivers/usb/gadget/u_uac1.c | |||
@@ -240,8 +240,11 @@ static int gaudio_open_snd_dev(struct gaudio *card) | |||
240 | snd = &card->playback; | 240 | snd = &card->playback; |
241 | snd->filp = filp_open(fn_play, O_WRONLY, 0); | 241 | snd->filp = filp_open(fn_play, O_WRONLY, 0); |
242 | if (IS_ERR(snd->filp)) { | 242 | if (IS_ERR(snd->filp)) { |
243 | int ret = PTR_ERR(snd->filp); | ||
244 | |||
243 | ERROR(card, "No such PCM playback device: %s\n", fn_play); | 245 | ERROR(card, "No such PCM playback device: %s\n", fn_play); |
244 | snd->filp = NULL; | 246 | snd->filp = NULL; |
247 | return ret; | ||
245 | } | 248 | } |
246 | pcm_file = snd->filp->private_data; | 249 | pcm_file = snd->filp->private_data; |
247 | snd->substream = pcm_file->substream; | 250 | snd->substream = pcm_file->substream; |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 2a9cd369f71c..f8f62c3ed65e 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -216,7 +216,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
216 | usb_gadget_disconnect(udc->gadget); | 216 | usb_gadget_disconnect(udc->gadget); |
217 | udc->driver->disconnect(udc->gadget); | 217 | udc->driver->disconnect(udc->gadget); |
218 | udc->driver->unbind(udc->gadget); | 218 | udc->driver->unbind(udc->gadget); |
219 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 219 | usb_gadget_udc_stop(udc->gadget, NULL); |
220 | 220 | ||
221 | udc->driver = NULL; | 221 | udc->driver = NULL; |
222 | udc->dev.driver = NULL; | 222 | udc->dev.driver = NULL; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b416a3fc9959..416a6dce5e11 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -302,6 +302,7 @@ static void ehci_quiesce (struct ehci_hcd *ehci) | |||
302 | 302 | ||
303 | static void end_unlink_async(struct ehci_hcd *ehci); | 303 | static void end_unlink_async(struct ehci_hcd *ehci); |
304 | static void unlink_empty_async(struct ehci_hcd *ehci); | 304 | static void unlink_empty_async(struct ehci_hcd *ehci); |
305 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci); | ||
305 | static void ehci_work(struct ehci_hcd *ehci); | 306 | static void ehci_work(struct ehci_hcd *ehci); |
306 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 307 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
307 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 308 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
@@ -748,11 +749,9 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
748 | /* guard against (alleged) silicon errata */ | 749 | /* guard against (alleged) silicon errata */ |
749 | if (cmd & CMD_IAAD) | 750 | if (cmd & CMD_IAAD) |
750 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); | 751 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); |
751 | if (ehci->async_iaa) { | 752 | if (ehci->async_iaa) |
752 | COUNT(ehci->stats.iaa); | 753 | COUNT(ehci->stats.iaa); |
753 | end_unlink_async(ehci); | 754 | end_unlink_async(ehci); |
754 | } else | ||
755 | ehci_dbg(ehci, "IAA with nothing unlinked?\n"); | ||
756 | } | 755 | } |
757 | 756 | ||
758 | /* remote wakeup [4.3.1] */ | 757 | /* remote wakeup [4.3.1] */ |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4d3b294f203e..7d06e77f6c4f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -328,7 +328,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
328 | ehci->rh_state = EHCI_RH_SUSPENDED; | 328 | ehci->rh_state = EHCI_RH_SUSPENDED; |
329 | 329 | ||
330 | end_unlink_async(ehci); | 330 | end_unlink_async(ehci); |
331 | unlink_empty_async(ehci); | 331 | unlink_empty_async_suspended(ehci); |
332 | ehci_handle_intr_unlinks(ehci); | 332 | ehci_handle_intr_unlinks(ehci); |
333 | end_free_itds(ehci); | 333 | end_free_itds(ehci); |
334 | 334 | ||
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index fd252f0cfb3a..23d136904285 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
135 | * qtd is updated in qh_completions(). Update the QH | 135 | * qtd is updated in qh_completions(). Update the QH |
136 | * overlay here. | 136 | * overlay here. |
137 | */ | 137 | */ |
138 | if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) { | 138 | if (qh->hw->hw_token & ACTIVE_BIT(ehci)) { |
139 | qh->hw->hw_qtd_next = qtd->hw_next; | 139 | qh->hw->hw_qtd_next = qtd->hw_next; |
140 | qtd = NULL; | 140 | qtd = NULL; |
141 | } | 141 | } |
@@ -449,11 +449,19 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
449 | else if (last_status == -EINPROGRESS && !urb->unlinked) | 449 | else if (last_status == -EINPROGRESS && !urb->unlinked) |
450 | continue; | 450 | continue; |
451 | 451 | ||
452 | /* qh unlinked; token in overlay may be most current */ | 452 | /* |
453 | if (state == QH_STATE_IDLE | 453 | * If this was the active qtd when the qh was unlinked |
454 | && cpu_to_hc32(ehci, qtd->qtd_dma) | 454 | * and the overlay's token is active, then the overlay |
455 | == hw->hw_current) { | 455 | * hasn't been written back to the qtd yet so use its |
456 | * token instead of the qtd's. After the qtd is | ||
457 | * processed and removed, the overlay won't be valid | ||
458 | * any more. | ||
459 | */ | ||
460 | if (state == QH_STATE_IDLE && | ||
461 | qh->qtd_list.next == &qtd->qtd_list && | ||
462 | (hw->hw_token & ACTIVE_BIT(ehci))) { | ||
456 | token = hc32_to_cpu(ehci, hw->hw_token); | 463 | token = hc32_to_cpu(ehci, hw->hw_token); |
464 | hw->hw_token &= ~ACTIVE_BIT(ehci); | ||
457 | 465 | ||
458 | /* An unlink may leave an incomplete | 466 | /* An unlink may leave an incomplete |
459 | * async transaction in the TT buffer. | 467 | * async transaction in the TT buffer. |
@@ -1170,7 +1178,7 @@ static void single_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
1170 | struct ehci_qh *prev; | 1178 | struct ehci_qh *prev; |
1171 | 1179 | ||
1172 | /* Add to the end of the list of QHs waiting for the next IAAD */ | 1180 | /* Add to the end of the list of QHs waiting for the next IAAD */ |
1173 | qh->qh_state = QH_STATE_UNLINK; | 1181 | qh->qh_state = QH_STATE_UNLINK_WAIT; |
1174 | if (ehci->async_unlink) | 1182 | if (ehci->async_unlink) |
1175 | ehci->async_unlink_last->unlink_next = qh; | 1183 | ehci->async_unlink_last->unlink_next = qh; |
1176 | else | 1184 | else |
@@ -1213,9 +1221,19 @@ static void start_iaa_cycle(struct ehci_hcd *ehci, bool nested) | |||
1213 | 1221 | ||
1214 | /* Do only the first waiting QH (nVidia bug?) */ | 1222 | /* Do only the first waiting QH (nVidia bug?) */ |
1215 | qh = ehci->async_unlink; | 1223 | qh = ehci->async_unlink; |
1216 | ehci->async_iaa = qh; | 1224 | |
1217 | ehci->async_unlink = qh->unlink_next; | 1225 | /* |
1218 | qh->unlink_next = NULL; | 1226 | * Intel (?) bug: The HC can write back the overlay region |
1227 | * even after the IAA interrupt occurs. In self-defense, | ||
1228 | * always go through two IAA cycles for each QH. | ||
1229 | */ | ||
1230 | if (qh->qh_state == QH_STATE_UNLINK_WAIT) { | ||
1231 | qh->qh_state = QH_STATE_UNLINK; | ||
1232 | } else { | ||
1233 | ehci->async_iaa = qh; | ||
1234 | ehci->async_unlink = qh->unlink_next; | ||
1235 | qh->unlink_next = NULL; | ||
1236 | } | ||
1219 | 1237 | ||
1220 | /* Make sure the unlinks are all visible to the hardware */ | 1238 | /* Make sure the unlinks are all visible to the hardware */ |
1221 | wmb(); | 1239 | wmb(); |
@@ -1298,6 +1316,19 @@ static void unlink_empty_async(struct ehci_hcd *ehci) | |||
1298 | } | 1316 | } |
1299 | } | 1317 | } |
1300 | 1318 | ||
1319 | /* The root hub is suspended; unlink all the async QHs */ | ||
1320 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci) | ||
1321 | { | ||
1322 | struct ehci_qh *qh; | ||
1323 | |||
1324 | while (ehci->async->qh_next.qh) { | ||
1325 | qh = ehci->async->qh_next.qh; | ||
1326 | WARN_ON(!list_empty(&qh->qtd_list)); | ||
1327 | single_unlink_async(ehci, qh); | ||
1328 | } | ||
1329 | start_iaa_cycle(ehci, false); | ||
1330 | } | ||
1331 | |||
1301 | /* makes sure the async qh will become idle */ | 1332 | /* makes sure the async qh will become idle */ |
1302 | /* caller must own ehci->lock */ | 1333 | /* caller must own ehci->lock */ |
1303 | 1334 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index b476daf49f6f..010f686d8881 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1214,6 +1214,7 @@ itd_urb_transaction ( | |||
1214 | 1214 | ||
1215 | memset (itd, 0, sizeof *itd); | 1215 | memset (itd, 0, sizeof *itd); |
1216 | itd->itd_dma = itd_dma; | 1216 | itd->itd_dma = itd_dma; |
1217 | itd->frame = 9999; /* an invalid value */ | ||
1217 | list_add (&itd->itd_list, &sched->td_list); | 1218 | list_add (&itd->itd_list, &sched->td_list); |
1218 | } | 1219 | } |
1219 | spin_unlock_irqrestore (&ehci->lock, flags); | 1220 | spin_unlock_irqrestore (&ehci->lock, flags); |
@@ -1915,6 +1916,7 @@ sitd_urb_transaction ( | |||
1915 | 1916 | ||
1916 | memset (sitd, 0, sizeof *sitd); | 1917 | memset (sitd, 0, sizeof *sitd); |
1917 | sitd->sitd_dma = sitd_dma; | 1918 | sitd->sitd_dma = sitd_dma; |
1919 | sitd->frame = 9999; /* an invalid value */ | ||
1918 | list_add (&sitd->sitd_list, &iso_sched->td_list); | 1920 | list_add (&sitd->sitd_list, &iso_sched->td_list); |
1919 | } | 1921 | } |
1920 | 1922 | ||
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c index 20dbdcbe9b0f..c3fa1305f830 100644 --- a/drivers/usb/host/ehci-timer.c +++ b/drivers/usb/host/ehci-timer.c | |||
@@ -304,7 +304,7 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci) | |||
304 | * (a) SMP races against real IAA firing and retriggering, and | 304 | * (a) SMP races against real IAA firing and retriggering, and |
305 | * (b) clean HC shutdown, when IAA watchdog was pending. | 305 | * (b) clean HC shutdown, when IAA watchdog was pending. |
306 | */ | 306 | */ |
307 | if (ehci->async_iaa) { | 307 | if (1) { |
308 | u32 cmd, status; | 308 | u32 cmd, status; |
309 | 309 | ||
310 | /* If we get here, IAA is *REALLY* late. It's barely | 310 | /* If we get here, IAA is *REALLY* late. It's barely |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 35616ffbe3ae..6dc238c592bc 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1022,44 +1022,24 @@ void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, | |||
1022 | * is attached to (or the roothub port its ancestor hub is attached to). All we | 1022 | * is attached to (or the roothub port its ancestor hub is attached to). All we |
1023 | * know is the index of that port under either the USB 2.0 or the USB 3.0 | 1023 | * know is the index of that port under either the USB 2.0 or the USB 3.0 |
1024 | * roothub, but that doesn't give us the real index into the HW port status | 1024 | * roothub, but that doesn't give us the real index into the HW port status |
1025 | * registers. Scan through the xHCI roothub port array, looking for the Nth | 1025 | * registers. Call xhci_find_raw_port_number() to get real index. |
1026 | * entry of the correct port speed. Return the port number of that entry. | ||
1027 | */ | 1026 | */ |
1028 | static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, | 1027 | static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, |
1029 | struct usb_device *udev) | 1028 | struct usb_device *udev) |
1030 | { | 1029 | { |
1031 | struct usb_device *top_dev; | 1030 | struct usb_device *top_dev; |
1032 | unsigned int num_similar_speed_ports; | 1031 | struct usb_hcd *hcd; |
1033 | unsigned int faked_port_num; | 1032 | |
1034 | int i; | 1033 | if (udev->speed == USB_SPEED_SUPER) |
1034 | hcd = xhci->shared_hcd; | ||
1035 | else | ||
1036 | hcd = xhci->main_hcd; | ||
1035 | 1037 | ||
1036 | for (top_dev = udev; top_dev->parent && top_dev->parent->parent; | 1038 | for (top_dev = udev; top_dev->parent && top_dev->parent->parent; |
1037 | top_dev = top_dev->parent) | 1039 | top_dev = top_dev->parent) |
1038 | /* Found device below root hub */; | 1040 | /* Found device below root hub */; |
1039 | faked_port_num = top_dev->portnum; | ||
1040 | for (i = 0, num_similar_speed_ports = 0; | ||
1041 | i < HCS_MAX_PORTS(xhci->hcs_params1); i++) { | ||
1042 | u8 port_speed = xhci->port_array[i]; | ||
1043 | |||
1044 | /* | ||
1045 | * Skip ports that don't have known speeds, or have duplicate | ||
1046 | * Extended Capabilities port speed entries. | ||
1047 | */ | ||
1048 | if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) | ||
1049 | continue; | ||
1050 | 1041 | ||
1051 | /* | 1042 | return xhci_find_raw_port_number(hcd, top_dev->portnum); |
1052 | * USB 3.0 ports are always under a USB 3.0 hub. USB 2.0 and | ||
1053 | * 1.1 ports are under the USB 2.0 hub. If the port speed | ||
1054 | * matches the device speed, it's a similar speed port. | ||
1055 | */ | ||
1056 | if ((port_speed == 0x03) == (udev->speed == USB_SPEED_SUPER)) | ||
1057 | num_similar_speed_ports++; | ||
1058 | if (num_similar_speed_ports == faked_port_num) | ||
1059 | /* Roothub ports are numbered from 1 to N */ | ||
1060 | return i+1; | ||
1061 | } | ||
1062 | return 0; | ||
1063 | } | 1043 | } |
1064 | 1044 | ||
1065 | /* Setup an xHCI virtual device for a Set Address command */ | 1045 | /* Setup an xHCI virtual device for a Set Address command */ |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index af259e0ec172..1a30c380043c 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -313,6 +313,7 @@ static const struct hc_driver xhci_pci_hc_driver = { | |||
313 | .set_usb2_hw_lpm = xhci_set_usb2_hardware_lpm, | 313 | .set_usb2_hw_lpm = xhci_set_usb2_hardware_lpm, |
314 | .enable_usb3_lpm_timeout = xhci_enable_usb3_lpm_timeout, | 314 | .enable_usb3_lpm_timeout = xhci_enable_usb3_lpm_timeout, |
315 | .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout, | 315 | .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout, |
316 | .find_raw_port_number = xhci_find_raw_port_number, | ||
316 | }; | 317 | }; |
317 | 318 | ||
318 | /*-------------------------------------------------------------------------*/ | 319 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 882875465301..1969c001b3f9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1599,14 +1599,20 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1599 | max_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1599 | max_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1600 | if ((port_id <= 0) || (port_id > max_ports)) { | 1600 | if ((port_id <= 0) || (port_id > max_ports)) { |
1601 | xhci_warn(xhci, "Invalid port id %d\n", port_id); | 1601 | xhci_warn(xhci, "Invalid port id %d\n", port_id); |
1602 | bogus_port_status = true; | 1602 | inc_deq(xhci, xhci->event_ring); |
1603 | goto cleanup; | 1603 | return; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | /* Figure out which usb_hcd this port is attached to: | 1606 | /* Figure out which usb_hcd this port is attached to: |
1607 | * is it a USB 3.0 port or a USB 2.0/1.1 port? | 1607 | * is it a USB 3.0 port or a USB 2.0/1.1 port? |
1608 | */ | 1608 | */ |
1609 | major_revision = xhci->port_array[port_id - 1]; | 1609 | major_revision = xhci->port_array[port_id - 1]; |
1610 | |||
1611 | /* Find the right roothub. */ | ||
1612 | hcd = xhci_to_hcd(xhci); | ||
1613 | if ((major_revision == 0x03) != (hcd->speed == HCD_USB3)) | ||
1614 | hcd = xhci->shared_hcd; | ||
1615 | |||
1610 | if (major_revision == 0) { | 1616 | if (major_revision == 0) { |
1611 | xhci_warn(xhci, "Event for port %u not in " | 1617 | xhci_warn(xhci, "Event for port %u not in " |
1612 | "Extended Capabilities, ignoring.\n", | 1618 | "Extended Capabilities, ignoring.\n", |
@@ -1629,10 +1635,6 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1629 | * into the index into the ports on the correct split roothub, and the | 1635 | * into the index into the ports on the correct split roothub, and the |
1630 | * correct bus_state structure. | 1636 | * correct bus_state structure. |
1631 | */ | 1637 | */ |
1632 | /* Find the right roothub. */ | ||
1633 | hcd = xhci_to_hcd(xhci); | ||
1634 | if ((major_revision == 0x03) != (hcd->speed == HCD_USB3)) | ||
1635 | hcd = xhci->shared_hcd; | ||
1636 | bus_state = &xhci->bus_state[hcd_index(hcd)]; | 1638 | bus_state = &xhci->bus_state[hcd_index(hcd)]; |
1637 | if (hcd->speed == HCD_USB3) | 1639 | if (hcd->speed == HCD_USB3) |
1638 | port_array = xhci->usb3_ports; | 1640 | port_array = xhci->usb3_ports; |
@@ -2027,8 +2029,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2027 | if (event_trb != ep_ring->dequeue && | 2029 | if (event_trb != ep_ring->dequeue && |
2028 | event_trb != td->last_trb) | 2030 | event_trb != td->last_trb) |
2029 | td->urb->actual_length = | 2031 | td->urb->actual_length = |
2030 | td->urb->transfer_buffer_length | 2032 | td->urb->transfer_buffer_length - |
2031 | - TRB_LEN(le32_to_cpu(event->transfer_len)); | 2033 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
2032 | else | 2034 | else |
2033 | td->urb->actual_length = 0; | 2035 | td->urb->actual_length = 0; |
2034 | 2036 | ||
@@ -2060,7 +2062,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2060 | /* Maybe the event was for the data stage? */ | 2062 | /* Maybe the event was for the data stage? */ |
2061 | td->urb->actual_length = | 2063 | td->urb->actual_length = |
2062 | td->urb->transfer_buffer_length - | 2064 | td->urb->transfer_buffer_length - |
2063 | TRB_LEN(le32_to_cpu(event->transfer_len)); | 2065 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
2064 | xhci_dbg(xhci, "Waiting for status " | 2066 | xhci_dbg(xhci, "Waiting for status " |
2065 | "stage event\n"); | 2067 | "stage event\n"); |
2066 | return 0; | 2068 | return 0; |
@@ -2096,7 +2098,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2096 | /* handle completion code */ | 2098 | /* handle completion code */ |
2097 | switch (trb_comp_code) { | 2099 | switch (trb_comp_code) { |
2098 | case COMP_SUCCESS: | 2100 | case COMP_SUCCESS: |
2099 | if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) { | 2101 | if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) { |
2100 | frame->status = 0; | 2102 | frame->status = 0; |
2101 | break; | 2103 | break; |
2102 | } | 2104 | } |
@@ -2141,7 +2143,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2141 | len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])); | 2143 | len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])); |
2142 | } | 2144 | } |
2143 | len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - | 2145 | len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - |
2144 | TRB_LEN(le32_to_cpu(event->transfer_len)); | 2146 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
2145 | 2147 | ||
2146 | if (trb_comp_code != COMP_STOP_INVAL) { | 2148 | if (trb_comp_code != COMP_STOP_INVAL) { |
2147 | frame->actual_length = len; | 2149 | frame->actual_length = len; |
@@ -2199,7 +2201,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2199 | case COMP_SUCCESS: | 2201 | case COMP_SUCCESS: |
2200 | /* Double check that the HW transferred everything. */ | 2202 | /* Double check that the HW transferred everything. */ |
2201 | if (event_trb != td->last_trb || | 2203 | if (event_trb != td->last_trb || |
2202 | TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { | 2204 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { |
2203 | xhci_warn(xhci, "WARN Successful completion " | 2205 | xhci_warn(xhci, "WARN Successful completion " |
2204 | "on short TX\n"); | 2206 | "on short TX\n"); |
2205 | if (td->urb->transfer_flags & URB_SHORT_NOT_OK) | 2207 | if (td->urb->transfer_flags & URB_SHORT_NOT_OK) |
@@ -2227,18 +2229,18 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2227 | "%d bytes untransferred\n", | 2229 | "%d bytes untransferred\n", |
2228 | td->urb->ep->desc.bEndpointAddress, | 2230 | td->urb->ep->desc.bEndpointAddress, |
2229 | td->urb->transfer_buffer_length, | 2231 | td->urb->transfer_buffer_length, |
2230 | TRB_LEN(le32_to_cpu(event->transfer_len))); | 2232 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len))); |
2231 | /* Fast path - was this the last TRB in the TD for this URB? */ | 2233 | /* Fast path - was this the last TRB in the TD for this URB? */ |
2232 | if (event_trb == td->last_trb) { | 2234 | if (event_trb == td->last_trb) { |
2233 | if (TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { | 2235 | if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { |
2234 | td->urb->actual_length = | 2236 | td->urb->actual_length = |
2235 | td->urb->transfer_buffer_length - | 2237 | td->urb->transfer_buffer_length - |
2236 | TRB_LEN(le32_to_cpu(event->transfer_len)); | 2238 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
2237 | if (td->urb->transfer_buffer_length < | 2239 | if (td->urb->transfer_buffer_length < |
2238 | td->urb->actual_length) { | 2240 | td->urb->actual_length) { |
2239 | xhci_warn(xhci, "HC gave bad length " | 2241 | xhci_warn(xhci, "HC gave bad length " |
2240 | "of %d bytes left\n", | 2242 | "of %d bytes left\n", |
2241 | TRB_LEN(le32_to_cpu(event->transfer_len))); | 2243 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len))); |
2242 | td->urb->actual_length = 0; | 2244 | td->urb->actual_length = 0; |
2243 | if (td->urb->transfer_flags & URB_SHORT_NOT_OK) | 2245 | if (td->urb->transfer_flags & URB_SHORT_NOT_OK) |
2244 | *status = -EREMOTEIO; | 2246 | *status = -EREMOTEIO; |
@@ -2280,7 +2282,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2280 | if (trb_comp_code != COMP_STOP_INVAL) | 2282 | if (trb_comp_code != COMP_STOP_INVAL) |
2281 | td->urb->actual_length += | 2283 | td->urb->actual_length += |
2282 | TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - | 2284 | TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - |
2283 | TRB_LEN(le32_to_cpu(event->transfer_len)); | 2285 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
2284 | } | 2286 | } |
2285 | 2287 | ||
2286 | return finish_td(xhci, td, event_trb, event, ep, status, false); | 2288 | return finish_td(xhci, td, event_trb, event, ep, status, false); |
@@ -2368,7 +2370,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2368 | * transfer type | 2370 | * transfer type |
2369 | */ | 2371 | */ |
2370 | case COMP_SUCCESS: | 2372 | case COMP_SUCCESS: |
2371 | if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) | 2373 | if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) |
2372 | break; | 2374 | break; |
2373 | if (xhci->quirks & XHCI_TRUST_TX_LENGTH) | 2375 | if (xhci->quirks & XHCI_TRUST_TX_LENGTH) |
2374 | trb_comp_code = COMP_SHORT_TX; | 2376 | trb_comp_code = COMP_SHORT_TX; |
@@ -2461,14 +2463,21 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2461 | * TD list. | 2463 | * TD list. |
2462 | */ | 2464 | */ |
2463 | if (list_empty(&ep_ring->td_list)) { | 2465 | if (list_empty(&ep_ring->td_list)) { |
2464 | xhci_warn(xhci, "WARN Event TRB for slot %d ep %d " | 2466 | /* |
2465 | "with no TDs queued?\n", | 2467 | * A stopped endpoint may generate an extra completion |
2466 | TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), | 2468 | * event if the device was suspended. Don't print |
2467 | ep_index); | 2469 | * warnings. |
2468 | xhci_dbg(xhci, "Event TRB with TRB type ID %u\n", | 2470 | */ |
2469 | (le32_to_cpu(event->flags) & | 2471 | if (!(trb_comp_code == COMP_STOP || |
2470 | TRB_TYPE_BITMASK)>>10); | 2472 | trb_comp_code == COMP_STOP_INVAL)) { |
2471 | xhci_print_trb_offsets(xhci, (union xhci_trb *) event); | 2473 | xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", |
2474 | TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), | ||
2475 | ep_index); | ||
2476 | xhci_dbg(xhci, "Event TRB with TRB type ID %u\n", | ||
2477 | (le32_to_cpu(event->flags) & | ||
2478 | TRB_TYPE_BITMASK)>>10); | ||
2479 | xhci_print_trb_offsets(xhci, (union xhci_trb *) event); | ||
2480 | } | ||
2472 | if (ep->skip) { | 2481 | if (ep->skip) { |
2473 | ep->skip = false; | 2482 | ep->skip = false; |
2474 | xhci_dbg(xhci, "td_list is empty while skip " | 2483 | xhci_dbg(xhci, "td_list is empty while skip " |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index f1f01a834ba7..53b8f89a0b1c 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -350,7 +350,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
350 | * generate interrupts. Don't even try to enable MSI. | 350 | * generate interrupts. Don't even try to enable MSI. |
351 | */ | 351 | */ |
352 | if (xhci->quirks & XHCI_BROKEN_MSI) | 352 | if (xhci->quirks & XHCI_BROKEN_MSI) |
353 | return 0; | 353 | goto legacy_irq; |
354 | 354 | ||
355 | /* unregister the legacy interrupt */ | 355 | /* unregister the legacy interrupt */ |
356 | if (hcd->irq) | 356 | if (hcd->irq) |
@@ -371,6 +371,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
371 | return -EINVAL; | 371 | return -EINVAL; |
372 | } | 372 | } |
373 | 373 | ||
374 | legacy_irq: | ||
374 | /* fall back to legacy interrupt*/ | 375 | /* fall back to legacy interrupt*/ |
375 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | 376 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
376 | hcd->irq_descr, hcd); | 377 | hcd->irq_descr, hcd); |
@@ -3778,6 +3779,28 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
3778 | return 0; | 3779 | return 0; |
3779 | } | 3780 | } |
3780 | 3781 | ||
3782 | /* | ||
3783 | * Transfer the port index into real index in the HW port status | ||
3784 | * registers. Caculate offset between the port's PORTSC register | ||
3785 | * and port status base. Divide the number of per port register | ||
3786 | * to get the real index. The raw port number bases 1. | ||
3787 | */ | ||
3788 | int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1) | ||
3789 | { | ||
3790 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
3791 | __le32 __iomem *base_addr = &xhci->op_regs->port_status_base; | ||
3792 | __le32 __iomem *addr; | ||
3793 | int raw_port; | ||
3794 | |||
3795 | if (hcd->speed != HCD_USB3) | ||
3796 | addr = xhci->usb2_ports[port1 - 1]; | ||
3797 | else | ||
3798 | addr = xhci->usb3_ports[port1 - 1]; | ||
3799 | |||
3800 | raw_port = (addr - base_addr)/NUM_PORT_REGS + 1; | ||
3801 | return raw_port; | ||
3802 | } | ||
3803 | |||
3781 | #ifdef CONFIG_USB_SUSPEND | 3804 | #ifdef CONFIG_USB_SUSPEND |
3782 | 3805 | ||
3783 | /* BESL to HIRD Encoding array for USB2 LPM */ | 3806 | /* BESL to HIRD Encoding array for USB2 LPM */ |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index f791bd0aee6c..63582719e0fb 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -206,8 +206,8 @@ struct xhci_op_regs { | |||
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | 208 | /* IMAN - Interrupt Management Register */ |
209 | #define IMAN_IP (1 << 1) | 209 | #define IMAN_IE (1 << 1) |
210 | #define IMAN_IE (1 << 0) | 210 | #define IMAN_IP (1 << 0) |
211 | 211 | ||
212 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
213 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
@@ -972,6 +972,10 @@ struct xhci_transfer_event { | |||
972 | __le32 flags; | 972 | __le32 flags; |
973 | }; | 973 | }; |
974 | 974 | ||
975 | /* Transfer event TRB length bit mask */ | ||
976 | /* bits 0:23 */ | ||
977 | #define EVENT_TRB_LEN(p) ((p) & 0xffffff) | ||
978 | |||
975 | /** Transfer Event bit fields **/ | 979 | /** Transfer Event bit fields **/ |
976 | #define TRB_TO_EP_ID(p) (((p) >> 16) & 0x1f) | 980 | #define TRB_TO_EP_ID(p) (((p) >> 16) & 0x1f) |
977 | 981 | ||
@@ -1829,6 +1833,7 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, | |||
1829 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, | 1833 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, |
1830 | char *buf, u16 wLength); | 1834 | char *buf, u16 wLength); |
1831 | int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); | 1835 | int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); |
1836 | int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); | ||
1832 | 1837 | ||
1833 | #ifdef CONFIG_PM | 1838 | #ifdef CONFIG_PM |
1834 | int xhci_bus_suspend(struct usb_hcd *hcd); | 1839 | int xhci_bus_suspend(struct usb_hcd *hcd); |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 45b19e2c60ba..05e51432dd2f 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -7,11 +7,6 @@ | |||
7 | config USB_MUSB_HDRC | 7 | config USB_MUSB_HDRC |
8 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' | 8 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' |
9 | depends on USB && USB_GADGET | 9 | depends on USB && USB_GADGET |
10 | select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) | ||
11 | select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX) | ||
12 | select TWL4030_USB if MACH_OMAP_3430SDP | ||
13 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | ||
14 | select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | ||
15 | select USB_OTG_UTILS | 10 | select USB_OTG_UTILS |
16 | help | 11 | help |
17 | Say Y here if your system has a dual role high speed USB | 12 | Say Y here if your system has a dual role high speed USB |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 7c71769d71ff..41613a2b35e8 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -327,7 +327,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); | 327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); |
328 | int err; | 328 | int err; |
329 | 329 | ||
330 | err = musb->int_usb & USB_INTR_VBUSERROR; | 330 | err = musb->int_usb & MUSB_INTR_VBUSERROR; |
331 | if (err) { | 331 | if (err) { |
332 | /* | 332 | /* |
333 | * The Mentor core doesn't debounce VBUS as needed | 333 | * The Mentor core doesn't debounce VBUS as needed |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 60b41cc28da4..daec6e0f7e38 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1624,8 +1624,6 @@ EXPORT_SYMBOL_GPL(musb_dma_completion); | |||
1624 | 1624 | ||
1625 | /*-------------------------------------------------------------------------*/ | 1625 | /*-------------------------------------------------------------------------*/ |
1626 | 1626 | ||
1627 | #ifdef CONFIG_SYSFS | ||
1628 | |||
1629 | static ssize_t | 1627 | static ssize_t |
1630 | musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) | 1628 | musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) |
1631 | { | 1629 | { |
@@ -1742,8 +1740,6 @@ static const struct attribute_group musb_attr_group = { | |||
1742 | .attrs = musb_attributes, | 1740 | .attrs = musb_attributes, |
1743 | }; | 1741 | }; |
1744 | 1742 | ||
1745 | #endif /* sysfs */ | ||
1746 | |||
1747 | /* Only used to provide driver mode change events */ | 1743 | /* Only used to provide driver mode change events */ |
1748 | static void musb_irq_work(struct work_struct *data) | 1744 | static void musb_irq_work(struct work_struct *data) |
1749 | { | 1745 | { |
@@ -1968,11 +1964,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1968 | if (status < 0) | 1964 | if (status < 0) |
1969 | goto fail4; | 1965 | goto fail4; |
1970 | 1966 | ||
1971 | #ifdef CONFIG_SYSFS | ||
1972 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); | 1967 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); |
1973 | if (status) | 1968 | if (status) |
1974 | goto fail5; | 1969 | goto fail5; |
1975 | #endif | ||
1976 | 1970 | ||
1977 | pm_runtime_put(musb->controller); | 1971 | pm_runtime_put(musb->controller); |
1978 | 1972 | ||
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index be18537c5f14..83eddedcd9be 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -141,7 +141,9 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
141 | static inline void unmap_dma_buffer(struct musb_request *request, | 141 | static inline void unmap_dma_buffer(struct musb_request *request, |
142 | struct musb *musb) | 142 | struct musb *musb) |
143 | { | 143 | { |
144 | if (!is_buffer_mapped(request)) | 144 | struct musb_ep *musb_ep = request->ep; |
145 | |||
146 | if (!is_buffer_mapped(request) || !musb_ep->dma) | ||
145 | return; | 147 | return; |
146 | 148 | ||
147 | if (request->request.dma == DMA_ADDR_INVALID) { | 149 | if (request->request.dma == DMA_ADDR_INVALID) { |
@@ -195,7 +197,10 @@ __acquires(ep->musb->lock) | |||
195 | 197 | ||
196 | ep->busy = 1; | 198 | ep->busy = 1; |
197 | spin_unlock(&musb->lock); | 199 | spin_unlock(&musb->lock); |
198 | unmap_dma_buffer(req, musb); | 200 | |
201 | if (!dma_mapping_error(&musb->g.dev, request->dma)) | ||
202 | unmap_dma_buffer(req, musb); | ||
203 | |||
199 | if (request->status == 0) | 204 | if (request->status == 0) |
200 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", | 205 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", |
201 | ep->end_point.name, request, | 206 | ep->end_point.name, request, |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 1762354fe793..1a42a458f2c4 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -51,7 +51,7 @@ struct omap2430_glue { | |||
51 | }; | 51 | }; |
52 | #define glue_to_musb(g) platform_get_drvdata(g->musb) | 52 | #define glue_to_musb(g) platform_get_drvdata(g->musb) |
53 | 53 | ||
54 | struct omap2430_glue *_glue; | 54 | static struct omap2430_glue *_glue; |
55 | 55 | ||
56 | static struct timer_list musb_idle_timer; | 56 | static struct timer_list musb_idle_timer; |
57 | 57 | ||
@@ -237,9 +237,13 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status) | |||
237 | { | 237 | { |
238 | struct omap2430_glue *glue = _glue; | 238 | struct omap2430_glue *glue = _glue; |
239 | 239 | ||
240 | if (glue && glue_to_musb(glue)) { | 240 | if (!glue) { |
241 | glue->status = status; | 241 | pr_err("%s: musb core is not yet initialized\n", __func__); |
242 | } else { | 242 | return; |
243 | } | ||
244 | glue->status = status; | ||
245 | |||
246 | if (!glue_to_musb(glue)) { | ||
243 | pr_err("%s: musb core is not yet ready\n", __func__); | 247 | pr_err("%s: musb core is not yet ready\n", __func__); |
244 | return; | 248 | return; |
245 | } | 249 | } |
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c index e1814397ca3a..2bd03d261a50 100644 --- a/drivers/usb/otg/otg.c +++ b/drivers/usb/otg/otg.c | |||
@@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type) | |||
130 | spin_lock_irqsave(&phy_lock, flags); | 130 | spin_lock_irqsave(&phy_lock, flags); |
131 | 131 | ||
132 | phy = __usb_find_phy(&phy_list, type); | 132 | phy = __usb_find_phy(&phy_list, type); |
133 | if (IS_ERR(phy)) { | 133 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
134 | pr_err("unable to find transceiver of type %s\n", | 134 | pr_err("unable to find transceiver of type %s\n", |
135 | usb_phy_type_string(type)); | 135 | usb_phy_type_string(type)); |
136 | goto err0; | 136 | goto err0; |
@@ -228,7 +228,7 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) | |||
228 | spin_lock_irqsave(&phy_lock, flags); | 228 | spin_lock_irqsave(&phy_lock, flags); |
229 | 229 | ||
230 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); | 230 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); |
231 | if (IS_ERR(phy)) { | 231 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
232 | pr_err("unable to find transceiver\n"); | 232 | pr_err("unable to find transceiver\n"); |
233 | goto err0; | 233 | goto err0; |
234 | } | 234 | } |
@@ -301,8 +301,12 @@ EXPORT_SYMBOL(devm_usb_put_phy); | |||
301 | */ | 301 | */ |
302 | void usb_put_phy(struct usb_phy *x) | 302 | void usb_put_phy(struct usb_phy *x) |
303 | { | 303 | { |
304 | if (x) | 304 | if (x) { |
305 | struct module *owner = x->dev->driver->owner; | ||
306 | |||
305 | put_device(x->dev); | 307 | put_device(x->dev); |
308 | module_put(owner); | ||
309 | } | ||
306 | } | 310 | } |
307 | EXPORT_SYMBOL(usb_put_phy); | 311 | EXPORT_SYMBOL(usb_put_phy); |
308 | 312 | ||
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 65217a590068..90549382eba5 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
@@ -38,6 +38,7 @@ config USB_ISP1301 | |||
38 | tristate "NXP ISP1301 USB transceiver support" | 38 | tristate "NXP ISP1301 USB transceiver support" |
39 | depends on USB || USB_GADGET | 39 | depends on USB || USB_GADGET |
40 | depends on I2C | 40 | depends on I2C |
41 | select USB_OTG_UTILS | ||
41 | help | 42 | help |
42 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. | 43 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. |
43 | This chip is typically used as USB transceiver for USB host, gadget | 44 | This chip is typically used as USB transceiver for USB host, gadget |
diff --git a/drivers/usb/phy/omap-control-usb.c b/drivers/usb/phy/omap-control-usb.c index 5323b71c3521..1419ceda9759 100644 --- a/drivers/usb/phy/omap-control-usb.c +++ b/drivers/usb/phy/omap-control-usb.c | |||
@@ -219,32 +219,26 @@ static int omap_control_usb_probe(struct platform_device *pdev) | |||
219 | 219 | ||
220 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 220 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
221 | "control_dev_conf"); | 221 | "control_dev_conf"); |
222 | control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res); | 222 | control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res); |
223 | if (!control_usb->dev_conf) { | 223 | if (IS_ERR(control_usb->dev_conf)) |
224 | dev_err(&pdev->dev, "Failed to obtain io memory\n"); | 224 | return PTR_ERR(control_usb->dev_conf); |
225 | return -EADDRNOTAVAIL; | ||
226 | } | ||
227 | 225 | ||
228 | if (control_usb->type == OMAP_CTRL_DEV_TYPE1) { | 226 | if (control_usb->type == OMAP_CTRL_DEV_TYPE1) { |
229 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 227 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
230 | "otghs_control"); | 228 | "otghs_control"); |
231 | control_usb->otghs_control = devm_request_and_ioremap( | 229 | control_usb->otghs_control = devm_ioremap_resource( |
232 | &pdev->dev, res); | 230 | &pdev->dev, res); |
233 | if (!control_usb->otghs_control) { | 231 | if (IS_ERR(control_usb->otghs_control)) |
234 | dev_err(&pdev->dev, "Failed to obtain io memory\n"); | 232 | return PTR_ERR(control_usb->otghs_control); |
235 | return -EADDRNOTAVAIL; | ||
236 | } | ||
237 | } | 233 | } |
238 | 234 | ||
239 | if (control_usb->type == OMAP_CTRL_DEV_TYPE2) { | 235 | if (control_usb->type == OMAP_CTRL_DEV_TYPE2) { |
240 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 236 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
241 | "phy_power_usb"); | 237 | "phy_power_usb"); |
242 | control_usb->phy_power = devm_request_and_ioremap( | 238 | control_usb->phy_power = devm_ioremap_resource( |
243 | &pdev->dev, res); | 239 | &pdev->dev, res); |
244 | if (!control_usb->phy_power) { | 240 | if (IS_ERR(control_usb->phy_power)) |
245 | dev_dbg(&pdev->dev, "Failed to obtain io memory\n"); | 241 | return PTR_ERR(control_usb->phy_power); |
246 | return -EADDRNOTAVAIL; | ||
247 | } | ||
248 | 242 | ||
249 | control_usb->sys_clk = devm_clk_get(control_usb->dev, | 243 | control_usb->sys_clk = devm_clk_get(control_usb->dev, |
250 | "sys_clkin"); | 244 | "sys_clkin"); |
diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c index fadc0c2b65bb..a6e60b1e102e 100644 --- a/drivers/usb/phy/omap-usb3.c +++ b/drivers/usb/phy/omap-usb3.c | |||
@@ -212,11 +212,9 @@ static int omap_usb3_probe(struct platform_device *pdev) | |||
212 | } | 212 | } |
213 | 213 | ||
214 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl"); | 214 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl"); |
215 | phy->pll_ctrl_base = devm_request_and_ioremap(&pdev->dev, res); | 215 | phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res); |
216 | if (!phy->pll_ctrl_base) { | 216 | if (IS_ERR(phy->pll_ctrl_base)) |
217 | dev_err(&pdev->dev, "ioremap of pll_ctrl failed\n"); | 217 | return PTR_ERR(phy->pll_ctrl_base); |
218 | return -ENOMEM; | ||
219 | } | ||
220 | 218 | ||
221 | phy->dev = &pdev->dev; | 219 | phy->dev = &pdev->dev; |
222 | 220 | ||
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 6ea553733832..967101ec15fd 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c | |||
@@ -787,11 +787,9 @@ static int samsung_usbphy_probe(struct platform_device *pdev) | |||
787 | return -ENODEV; | 787 | return -ENODEV; |
788 | } | 788 | } |
789 | 789 | ||
790 | phy_base = devm_request_and_ioremap(dev, phy_mem); | 790 | phy_base = devm_ioremap_resource(dev, phy_mem); |
791 | if (!phy_base) { | 791 | if (IS_ERR(phy_base)) |
792 | dev_err(dev, "%s: register mapping failed\n", __func__); | 792 | return PTR_ERR(phy_base); |
793 | return -ENXIO; | ||
794 | } | ||
795 | 793 | ||
796 | sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL); | 794 | sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL); |
797 | if (!sphy) | 795 | if (!sphy) |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index cbd904b8fba5..4775f8209e55 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | struct ark3116_private { | 64 | struct ark3116_private { |
65 | wait_queue_head_t delta_msr_wait; | ||
66 | struct async_icount icount; | 65 | struct async_icount icount; |
67 | int irda; /* 1 for irda device */ | 66 | int irda; /* 1 for irda device */ |
68 | 67 | ||
@@ -146,7 +145,6 @@ static int ark3116_port_probe(struct usb_serial_port *port) | |||
146 | if (!priv) | 145 | if (!priv) |
147 | return -ENOMEM; | 146 | return -ENOMEM; |
148 | 147 | ||
149 | init_waitqueue_head(&priv->delta_msr_wait); | ||
150 | mutex_init(&priv->hw_lock); | 148 | mutex_init(&priv->hw_lock); |
151 | spin_lock_init(&priv->status_lock); | 149 | spin_lock_init(&priv->status_lock); |
152 | 150 | ||
@@ -456,10 +454,14 @@ static int ark3116_ioctl(struct tty_struct *tty, | |||
456 | case TIOCMIWAIT: | 454 | case TIOCMIWAIT: |
457 | for (;;) { | 455 | for (;;) { |
458 | struct async_icount prev = priv->icount; | 456 | struct async_icount prev = priv->icount; |
459 | interruptible_sleep_on(&priv->delta_msr_wait); | 457 | interruptible_sleep_on(&port->delta_msr_wait); |
460 | /* see if a signal did it */ | 458 | /* see if a signal did it */ |
461 | if (signal_pending(current)) | 459 | if (signal_pending(current)) |
462 | return -ERESTARTSYS; | 460 | return -ERESTARTSYS; |
461 | |||
462 | if (port->serial->disconnected) | ||
463 | return -EIO; | ||
464 | |||
463 | if ((prev.rng == priv->icount.rng) && | 465 | if ((prev.rng == priv->icount.rng) && |
464 | (prev.dsr == priv->icount.dsr) && | 466 | (prev.dsr == priv->icount.dsr) && |
465 | (prev.dcd == priv->icount.dcd) && | 467 | (prev.dcd == priv->icount.dcd) && |
@@ -580,7 +582,7 @@ static void ark3116_update_msr(struct usb_serial_port *port, __u8 msr) | |||
580 | priv->icount.dcd++; | 582 | priv->icount.dcd++; |
581 | if (msr & UART_MSR_TERI) | 583 | if (msr & UART_MSR_TERI) |
582 | priv->icount.rng++; | 584 | priv->icount.rng++; |
583 | wake_up_interruptible(&priv->delta_msr_wait); | 585 | wake_up_interruptible(&port->delta_msr_wait); |
584 | } | 586 | } |
585 | } | 587 | } |
586 | 588 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index d255f66e708e..07d4650a32ab 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -80,7 +80,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
80 | 80 | ||
81 | struct ch341_private { | 81 | struct ch341_private { |
82 | spinlock_t lock; /* access lock */ | 82 | spinlock_t lock; /* access lock */ |
83 | wait_queue_head_t delta_msr_wait; /* wait queue for modem status */ | ||
84 | unsigned baud_rate; /* set baud rate */ | 83 | unsigned baud_rate; /* set baud rate */ |
85 | u8 line_control; /* set line control value RTS/DTR */ | 84 | u8 line_control; /* set line control value RTS/DTR */ |
86 | u8 line_status; /* active status of modem control inputs */ | 85 | u8 line_status; /* active status of modem control inputs */ |
@@ -252,7 +251,6 @@ static int ch341_port_probe(struct usb_serial_port *port) | |||
252 | return -ENOMEM; | 251 | return -ENOMEM; |
253 | 252 | ||
254 | spin_lock_init(&priv->lock); | 253 | spin_lock_init(&priv->lock); |
255 | init_waitqueue_head(&priv->delta_msr_wait); | ||
256 | priv->baud_rate = DEFAULT_BAUD_RATE; | 254 | priv->baud_rate = DEFAULT_BAUD_RATE; |
257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 255 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
258 | 256 | ||
@@ -298,7 +296,7 @@ static void ch341_dtr_rts(struct usb_serial_port *port, int on) | |||
298 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); | 296 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); |
299 | spin_unlock_irqrestore(&priv->lock, flags); | 297 | spin_unlock_irqrestore(&priv->lock, flags); |
300 | ch341_set_handshake(port->serial->dev, priv->line_control); | 298 | ch341_set_handshake(port->serial->dev, priv->line_control); |
301 | wake_up_interruptible(&priv->delta_msr_wait); | 299 | wake_up_interruptible(&port->delta_msr_wait); |
302 | } | 300 | } |
303 | 301 | ||
304 | static void ch341_close(struct usb_serial_port *port) | 302 | static void ch341_close(struct usb_serial_port *port) |
@@ -491,7 +489,7 @@ static void ch341_read_int_callback(struct urb *urb) | |||
491 | tty_kref_put(tty); | 489 | tty_kref_put(tty); |
492 | } | 490 | } |
493 | 491 | ||
494 | wake_up_interruptible(&priv->delta_msr_wait); | 492 | wake_up_interruptible(&port->delta_msr_wait); |
495 | } | 493 | } |
496 | 494 | ||
497 | exit: | 495 | exit: |
@@ -517,11 +515,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
517 | spin_unlock_irqrestore(&priv->lock, flags); | 515 | spin_unlock_irqrestore(&priv->lock, flags); |
518 | 516 | ||
519 | while (!multi_change) { | 517 | while (!multi_change) { |
520 | interruptible_sleep_on(&priv->delta_msr_wait); | 518 | interruptible_sleep_on(&port->delta_msr_wait); |
521 | /* see if a signal did it */ | 519 | /* see if a signal did it */ |
522 | if (signal_pending(current)) | 520 | if (signal_pending(current)) |
523 | return -ERESTARTSYS; | 521 | return -ERESTARTSYS; |
524 | 522 | ||
523 | if (port->serial->disconnected) | ||
524 | return -EIO; | ||
525 | |||
525 | spin_lock_irqsave(&priv->lock, flags); | 526 | spin_lock_irqsave(&priv->lock, flags); |
526 | status = priv->line_status; | 527 | status = priv->line_status; |
527 | multi_change = priv->multi_status_change; | 528 | multi_change = priv->multi_status_change; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index edc0f0dcad83..4747d1c328ff 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -85,6 +85,7 @@ static const struct usb_device_id id_table[] = { | |||
85 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ | 85 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
86 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 86 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
87 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 87 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
88 | { USB_DEVICE(0x2405, 0x0003) }, /* West Mountain Radio RIGblaster Advantage */ | ||
88 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 89 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
89 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | 90 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
90 | { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ | 91 | { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ |
@@ -150,6 +151,25 @@ static const struct usb_device_id id_table[] = { | |||
150 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 151 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
151 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | 152 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ |
152 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ | 153 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ |
154 | { USB_DEVICE(0x1FB9, 0x0100) }, /* Lake Shore Model 121 Current Source */ | ||
155 | { USB_DEVICE(0x1FB9, 0x0200) }, /* Lake Shore Model 218A Temperature Monitor */ | ||
156 | { USB_DEVICE(0x1FB9, 0x0201) }, /* Lake Shore Model 219 Temperature Monitor */ | ||
157 | { USB_DEVICE(0x1FB9, 0x0202) }, /* Lake Shore Model 233 Temperature Transmitter */ | ||
158 | { USB_DEVICE(0x1FB9, 0x0203) }, /* Lake Shore Model 235 Temperature Transmitter */ | ||
159 | { USB_DEVICE(0x1FB9, 0x0300) }, /* Lake Shore Model 335 Temperature Controller */ | ||
160 | { USB_DEVICE(0x1FB9, 0x0301) }, /* Lake Shore Model 336 Temperature Controller */ | ||
161 | { USB_DEVICE(0x1FB9, 0x0302) }, /* Lake Shore Model 350 Temperature Controller */ | ||
162 | { USB_DEVICE(0x1FB9, 0x0303) }, /* Lake Shore Model 371 AC Bridge */ | ||
163 | { USB_DEVICE(0x1FB9, 0x0400) }, /* Lake Shore Model 411 Handheld Gaussmeter */ | ||
164 | { USB_DEVICE(0x1FB9, 0x0401) }, /* Lake Shore Model 425 Gaussmeter */ | ||
165 | { USB_DEVICE(0x1FB9, 0x0402) }, /* Lake Shore Model 455A Gaussmeter */ | ||
166 | { USB_DEVICE(0x1FB9, 0x0403) }, /* Lake Shore Model 475A Gaussmeter */ | ||
167 | { USB_DEVICE(0x1FB9, 0x0404) }, /* Lake Shore Model 465 Three Axis Gaussmeter */ | ||
168 | { USB_DEVICE(0x1FB9, 0x0600) }, /* Lake Shore Model 625A Superconducting MPS */ | ||
169 | { USB_DEVICE(0x1FB9, 0x0601) }, /* Lake Shore Model 642A Magnet Power Supply */ | ||
170 | { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ | ||
171 | { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ | ||
172 | { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ | ||
153 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 173 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
154 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | 174 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
155 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | 175 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 8efa19d0e9fb..ba7352e4187e 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -111,7 +111,6 @@ struct cypress_private { | |||
111 | int baud_rate; /* stores current baud rate in | 111 | int baud_rate; /* stores current baud rate in |
112 | integer form */ | 112 | integer form */ |
113 | int isthrottled; /* if throttled, discard reads */ | 113 | int isthrottled; /* if throttled, discard reads */ |
114 | wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */ | ||
115 | char prev_status, diff_status; /* used for TIOCMIWAIT */ | 114 | char prev_status, diff_status; /* used for TIOCMIWAIT */ |
116 | /* we pass a pointer to this as the argument sent to | 115 | /* we pass a pointer to this as the argument sent to |
117 | cypress_set_termios old_termios */ | 116 | cypress_set_termios old_termios */ |
@@ -449,7 +448,6 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) | |||
449 | kfree(priv); | 448 | kfree(priv); |
450 | return -ENOMEM; | 449 | return -ENOMEM; |
451 | } | 450 | } |
452 | init_waitqueue_head(&priv->delta_msr_wait); | ||
453 | 451 | ||
454 | usb_reset_configuration(serial->dev); | 452 | usb_reset_configuration(serial->dev); |
455 | 453 | ||
@@ -868,12 +866,16 @@ static int cypress_ioctl(struct tty_struct *tty, | |||
868 | switch (cmd) { | 866 | switch (cmd) { |
869 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ | 867 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ |
870 | case TIOCMIWAIT: | 868 | case TIOCMIWAIT: |
871 | while (priv != NULL) { | 869 | for (;;) { |
872 | interruptible_sleep_on(&priv->delta_msr_wait); | 870 | interruptible_sleep_on(&port->delta_msr_wait); |
873 | /* see if a signal did it */ | 871 | /* see if a signal did it */ |
874 | if (signal_pending(current)) | 872 | if (signal_pending(current)) |
875 | return -ERESTARTSYS; | 873 | return -ERESTARTSYS; |
876 | else { | 874 | |
875 | if (port->serial->disconnected) | ||
876 | return -EIO; | ||
877 | |||
878 | { | ||
877 | char diff = priv->diff_status; | 879 | char diff = priv->diff_status; |
878 | if (diff == 0) | 880 | if (diff == 0) |
879 | return -EIO; /* no change => error */ | 881 | return -EIO; /* no change => error */ |
@@ -1187,7 +1189,7 @@ static void cypress_read_int_callback(struct urb *urb) | |||
1187 | if (priv->current_status != priv->prev_status) { | 1189 | if (priv->current_status != priv->prev_status) { |
1188 | priv->diff_status |= priv->current_status ^ | 1190 | priv->diff_status |= priv->current_status ^ |
1189 | priv->prev_status; | 1191 | priv->prev_status; |
1190 | wake_up_interruptible(&priv->delta_msr_wait); | 1192 | wake_up_interruptible(&port->delta_msr_wait); |
1191 | priv->prev_status = priv->current_status; | 1193 | priv->prev_status = priv->current_status; |
1192 | } | 1194 | } |
1193 | spin_unlock_irqrestore(&priv->lock, flags); | 1195 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index b1b2dc64b50b..a172ad5c5ce8 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
47 | 47 | ||
48 | struct f81232_private { | 48 | struct f81232_private { |
49 | spinlock_t lock; | 49 | spinlock_t lock; |
50 | wait_queue_head_t delta_msr_wait; | ||
51 | u8 line_control; | 50 | u8 line_control; |
52 | u8 line_status; | 51 | u8 line_status; |
53 | }; | 52 | }; |
@@ -111,7 +110,7 @@ static void f81232_process_read_urb(struct urb *urb) | |||
111 | line_status = priv->line_status; | 110 | line_status = priv->line_status; |
112 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 111 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
113 | spin_unlock_irqrestore(&priv->lock, flags); | 112 | spin_unlock_irqrestore(&priv->lock, flags); |
114 | wake_up_interruptible(&priv->delta_msr_wait); | 113 | wake_up_interruptible(&port->delta_msr_wait); |
115 | 114 | ||
116 | if (!urb->actual_length) | 115 | if (!urb->actual_length) |
117 | return; | 116 | return; |
@@ -256,11 +255,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
256 | spin_unlock_irqrestore(&priv->lock, flags); | 255 | spin_unlock_irqrestore(&priv->lock, flags); |
257 | 256 | ||
258 | while (1) { | 257 | while (1) { |
259 | interruptible_sleep_on(&priv->delta_msr_wait); | 258 | interruptible_sleep_on(&port->delta_msr_wait); |
260 | /* see if a signal did it */ | 259 | /* see if a signal did it */ |
261 | if (signal_pending(current)) | 260 | if (signal_pending(current)) |
262 | return -ERESTARTSYS; | 261 | return -ERESTARTSYS; |
263 | 262 | ||
263 | if (port->serial->disconnected) | ||
264 | return -EIO; | ||
265 | |||
264 | spin_lock_irqsave(&priv->lock, flags); | 266 | spin_lock_irqsave(&priv->lock, flags); |
265 | status = priv->line_status; | 267 | status = priv->line_status; |
266 | spin_unlock_irqrestore(&priv->lock, flags); | 268 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -322,7 +324,6 @@ static int f81232_port_probe(struct usb_serial_port *port) | |||
322 | return -ENOMEM; | 324 | return -ENOMEM; |
323 | 325 | ||
324 | spin_lock_init(&priv->lock); | 326 | spin_lock_init(&priv->lock); |
325 | init_waitqueue_head(&priv->delta_msr_wait); | ||
326 | 327 | ||
327 | usb_set_serial_port_data(port, priv); | 328 | usb_set_serial_port_data(port, priv); |
328 | 329 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edd162df49ca..9886180e45f1 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -69,9 +69,7 @@ struct ftdi_private { | |||
69 | int flags; /* some ASYNC_xxxx flags are supported */ | 69 | int flags; /* some ASYNC_xxxx flags are supported */ |
70 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 70 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
71 | struct async_icount icount; | 71 | struct async_icount icount; |
72 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
73 | char prev_status; /* Used for TIOCMIWAIT */ | 72 | char prev_status; /* Used for TIOCMIWAIT */ |
74 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
75 | char transmit_empty; /* If transmitter is empty or not */ | 73 | char transmit_empty; /* If transmitter is empty or not */ |
76 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 74 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
77 | (0 for FT232/245) */ | 75 | (0 for FT232/245) */ |
@@ -642,6 +640,7 @@ static struct usb_device_id id_table_combined [] = { | |||
642 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, | 640 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
643 | { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, | 641 | { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, |
644 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, | 642 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, |
643 | { USB_DEVICE(MITSUBISHI_VID, MITSUBISHI_FXUSB_PID) }, | ||
645 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, | 644 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
646 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, | 645 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, |
647 | { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, | 646 | { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, |
@@ -1691,10 +1690,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1691 | 1690 | ||
1692 | kref_init(&priv->kref); | 1691 | kref_init(&priv->kref); |
1693 | mutex_init(&priv->cfg_lock); | 1692 | mutex_init(&priv->cfg_lock); |
1694 | init_waitqueue_head(&priv->delta_msr_wait); | ||
1695 | 1693 | ||
1696 | priv->flags = ASYNC_LOW_LATENCY; | 1694 | priv->flags = ASYNC_LOW_LATENCY; |
1697 | priv->dev_gone = false; | ||
1698 | 1695 | ||
1699 | if (quirk && quirk->port_probe) | 1696 | if (quirk && quirk->port_probe) |
1700 | quirk->port_probe(priv); | 1697 | quirk->port_probe(priv); |
@@ -1840,8 +1837,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1840 | { | 1837 | { |
1841 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1838 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1842 | 1839 | ||
1843 | priv->dev_gone = true; | 1840 | wake_up_interruptible(&port->delta_msr_wait); |
1844 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1845 | 1841 | ||
1846 | remove_sysfs_attrs(port); | 1842 | remove_sysfs_attrs(port); |
1847 | 1843 | ||
@@ -1989,7 +1985,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, | |||
1989 | if (diff_status & FTDI_RS0_RLSD) | 1985 | if (diff_status & FTDI_RS0_RLSD) |
1990 | priv->icount.dcd++; | 1986 | priv->icount.dcd++; |
1991 | 1987 | ||
1992 | wake_up_interruptible_all(&priv->delta_msr_wait); | 1988 | wake_up_interruptible(&port->delta_msr_wait); |
1993 | priv->prev_status = status; | 1989 | priv->prev_status = status; |
1994 | } | 1990 | } |
1995 | 1991 | ||
@@ -2440,11 +2436,15 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2440 | */ | 2436 | */ |
2441 | case TIOCMIWAIT: | 2437 | case TIOCMIWAIT: |
2442 | cprev = priv->icount; | 2438 | cprev = priv->icount; |
2443 | while (!priv->dev_gone) { | 2439 | for (;;) { |
2444 | interruptible_sleep_on(&priv->delta_msr_wait); | 2440 | interruptible_sleep_on(&port->delta_msr_wait); |
2445 | /* see if a signal did it */ | 2441 | /* see if a signal did it */ |
2446 | if (signal_pending(current)) | 2442 | if (signal_pending(current)) |
2447 | return -ERESTARTSYS; | 2443 | return -ERESTARTSYS; |
2444 | |||
2445 | if (port->serial->disconnected) | ||
2446 | return -EIO; | ||
2447 | |||
2448 | cnow = priv->icount; | 2448 | cnow = priv->icount; |
2449 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2449 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2450 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2450 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
@@ -2454,8 +2454,6 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2454 | } | 2454 | } |
2455 | cprev = cnow; | 2455 | cprev = cnow; |
2456 | } | 2456 | } |
2457 | return -EIO; | ||
2458 | break; | ||
2459 | case TIOCSERGETLSR: | 2457 | case TIOCSERGETLSR: |
2460 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2458 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
2461 | break; | 2459 | break; |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 9d359e189a64..e79861eeed4c 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -584,6 +584,13 @@ | |||
584 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ | 584 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ |
585 | 585 | ||
586 | /* | 586 | /* |
587 | * Mitsubishi Electric Corp. (http://www.meau.com) | ||
588 | * Submitted by Konstantin Holoborodko | ||
589 | */ | ||
590 | #define MITSUBISHI_VID 0x06D3 | ||
591 | #define MITSUBISHI_FXUSB_PID 0x0284 /* USB/RS422 converters: FX-USB-AW/-BD */ | ||
592 | |||
593 | /* | ||
587 | * Definitions for B&B Electronics products. | 594 | * Definitions for B&B Electronics products. |
588 | */ | 595 | */ |
589 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ | 596 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1a07b12ef341..81caf5623ee2 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -956,10 +956,7 @@ static void garmin_close(struct usb_serial_port *port) | |||
956 | if (!serial) | 956 | if (!serial) |
957 | return; | 957 | return; |
958 | 958 | ||
959 | mutex_lock(&port->serial->disc_mutex); | 959 | garmin_clear(garmin_data_p); |
960 | |||
961 | if (!port->serial->disconnected) | ||
962 | garmin_clear(garmin_data_p); | ||
963 | 960 | ||
964 | /* shutdown our urbs */ | 961 | /* shutdown our urbs */ |
965 | usb_kill_urb(port->read_urb); | 962 | usb_kill_urb(port->read_urb); |
@@ -968,8 +965,6 @@ static void garmin_close(struct usb_serial_port *port) | |||
968 | /* keep reset state so we know that we must start a new session */ | 965 | /* keep reset state so we know that we must start a new session */ |
969 | if (garmin_data_p->state != STATE_RESET) | 966 | if (garmin_data_p->state != STATE_RESET) |
970 | garmin_data_p->state = STATE_DISCONNECTED; | 967 | garmin_data_p->state = STATE_DISCONNECTED; |
971 | |||
972 | mutex_unlock(&port->serial->disc_mutex); | ||
973 | } | 968 | } |
974 | 969 | ||
975 | 970 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b00e5cbf741f..efd8b978128c 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -110,7 +110,6 @@ struct edgeport_port { | |||
110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ | 111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ |
112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ | 112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ |
113 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
114 | 113 | ||
115 | struct async_icount icount; | 114 | struct async_icount icount; |
116 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 115 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
@@ -884,7 +883,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
884 | /* initialize our wait queues */ | 883 | /* initialize our wait queues */ |
885 | init_waitqueue_head(&edge_port->wait_open); | 884 | init_waitqueue_head(&edge_port->wait_open); |
886 | init_waitqueue_head(&edge_port->wait_chase); | 885 | init_waitqueue_head(&edge_port->wait_chase); |
887 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
888 | init_waitqueue_head(&edge_port->wait_command); | 886 | init_waitqueue_head(&edge_port->wait_command); |
889 | 887 | ||
890 | /* initialize our icount structure */ | 888 | /* initialize our icount structure */ |
@@ -1669,13 +1667,17 @@ static int edge_ioctl(struct tty_struct *tty, | |||
1669 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); | 1667 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); |
1670 | cprev = edge_port->icount; | 1668 | cprev = edge_port->icount; |
1671 | while (1) { | 1669 | while (1) { |
1672 | prepare_to_wait(&edge_port->delta_msr_wait, | 1670 | prepare_to_wait(&port->delta_msr_wait, |
1673 | &wait, TASK_INTERRUPTIBLE); | 1671 | &wait, TASK_INTERRUPTIBLE); |
1674 | schedule(); | 1672 | schedule(); |
1675 | finish_wait(&edge_port->delta_msr_wait, &wait); | 1673 | finish_wait(&port->delta_msr_wait, &wait); |
1676 | /* see if a signal did it */ | 1674 | /* see if a signal did it */ |
1677 | if (signal_pending(current)) | 1675 | if (signal_pending(current)) |
1678 | return -ERESTARTSYS; | 1676 | return -ERESTARTSYS; |
1677 | |||
1678 | if (port->serial->disconnected) | ||
1679 | return -EIO; | ||
1680 | |||
1679 | cnow = edge_port->icount; | 1681 | cnow = edge_port->icount; |
1680 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 1682 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
1681 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 1683 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -2051,7 +2053,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) | |||
2051 | icount->dcd++; | 2053 | icount->dcd++; |
2052 | if (newMsr & EDGEPORT_MSR_DELTA_RI) | 2054 | if (newMsr & EDGEPORT_MSR_DELTA_RI) |
2053 | icount->rng++; | 2055 | icount->rng++; |
2054 | wake_up_interruptible(&edge_port->delta_msr_wait); | 2056 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
2055 | } | 2057 | } |
2056 | 2058 | ||
2057 | /* Save the new modem status */ | 2059 | /* Save the new modem status */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c23776679f70..7777172206de 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -87,9 +87,6 @@ struct edgeport_port { | |||
87 | int close_pending; | 87 | int close_pending; |
88 | int lsr_event; | 88 | int lsr_event; |
89 | struct async_icount icount; | 89 | struct async_icount icount; |
90 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while | ||
91 | waiting for msr change to | ||
92 | happen */ | ||
93 | struct edgeport_serial *edge_serial; | 90 | struct edgeport_serial *edge_serial; |
94 | struct usb_serial_port *port; | 91 | struct usb_serial_port *port; |
95 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ | 92 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ |
@@ -1459,7 +1456,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) | |||
1459 | icount->dcd++; | 1456 | icount->dcd++; |
1460 | if (msr & EDGEPORT_MSR_DELTA_RI) | 1457 | if (msr & EDGEPORT_MSR_DELTA_RI) |
1461 | icount->rng++; | 1458 | icount->rng++; |
1462 | wake_up_interruptible(&edge_port->delta_msr_wait); | 1459 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
1463 | } | 1460 | } |
1464 | 1461 | ||
1465 | /* Save the new modem status */ | 1462 | /* Save the new modem status */ |
@@ -1754,7 +1751,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1754 | dev = port->serial->dev; | 1751 | dev = port->serial->dev; |
1755 | 1752 | ||
1756 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); | 1753 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); |
1757 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
1758 | 1754 | ||
1759 | /* turn off loopback */ | 1755 | /* turn off loopback */ |
1760 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); | 1756 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); |
@@ -2434,10 +2430,14 @@ static int edge_ioctl(struct tty_struct *tty, | |||
2434 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 2430 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
2435 | cprev = edge_port->icount; | 2431 | cprev = edge_port->icount; |
2436 | while (1) { | 2432 | while (1) { |
2437 | interruptible_sleep_on(&edge_port->delta_msr_wait); | 2433 | interruptible_sleep_on(&port->delta_msr_wait); |
2438 | /* see if a signal did it */ | 2434 | /* see if a signal did it */ |
2439 | if (signal_pending(current)) | 2435 | if (signal_pending(current)) |
2440 | return -ERESTARTSYS; | 2436 | return -ERESTARTSYS; |
2437 | |||
2438 | if (port->serial->disconnected) | ||
2439 | return -EIO; | ||
2440 | |||
2441 | cnow = edge_port->icount; | 2441 | cnow = edge_port->icount; |
2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -2649,6 +2649,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
2649 | .set_termios = edge_set_termios, | 2649 | .set_termios = edge_set_termios, |
2650 | .tiocmget = edge_tiocmget, | 2650 | .tiocmget = edge_tiocmget, |
2651 | .tiocmset = edge_tiocmset, | 2651 | .tiocmset = edge_tiocmset, |
2652 | .get_icount = edge_get_icount, | ||
2652 | .write = edge_write, | 2653 | .write = edge_write, |
2653 | .write_room = edge_write_room, | 2654 | .write_room = edge_write_room, |
2654 | .chars_in_buffer = edge_chars_in_buffer, | 2655 | .chars_in_buffer = edge_chars_in_buffer, |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index a64d420f687b..06d5a60be2c4 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -114,8 +114,6 @@ struct mct_u232_private { | |||
114 | unsigned char last_msr; /* Modem Status Register */ | 114 | unsigned char last_msr; /* Modem Status Register */ |
115 | unsigned int rx_flags; /* Throttling flags */ | 115 | unsigned int rx_flags; /* Throttling flags */ |
116 | struct async_icount icount; | 116 | struct async_icount icount; |
117 | wait_queue_head_t msr_wait; /* for handling sleeping while waiting | ||
118 | for msr change to happen */ | ||
119 | }; | 117 | }; |
120 | 118 | ||
121 | #define THROTTLED 0x01 | 119 | #define THROTTLED 0x01 |
@@ -409,7 +407,6 @@ static int mct_u232_port_probe(struct usb_serial_port *port) | |||
409 | return -ENOMEM; | 407 | return -ENOMEM; |
410 | 408 | ||
411 | spin_lock_init(&priv->lock); | 409 | spin_lock_init(&priv->lock); |
412 | init_waitqueue_head(&priv->msr_wait); | ||
413 | 410 | ||
414 | usb_set_serial_port_data(port, priv); | 411 | usb_set_serial_port_data(port, priv); |
415 | 412 | ||
@@ -601,7 +598,7 @@ static void mct_u232_read_int_callback(struct urb *urb) | |||
601 | tty_kref_put(tty); | 598 | tty_kref_put(tty); |
602 | } | 599 | } |
603 | #endif | 600 | #endif |
604 | wake_up_interruptible(&priv->msr_wait); | 601 | wake_up_interruptible(&port->delta_msr_wait); |
605 | spin_unlock_irqrestore(&priv->lock, flags); | 602 | spin_unlock_irqrestore(&priv->lock, flags); |
606 | exit: | 603 | exit: |
607 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 604 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -810,13 +807,17 @@ static int mct_u232_ioctl(struct tty_struct *tty, | |||
810 | cprev = mct_u232_port->icount; | 807 | cprev = mct_u232_port->icount; |
811 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 808 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
812 | for ( ; ; ) { | 809 | for ( ; ; ) { |
813 | prepare_to_wait(&mct_u232_port->msr_wait, | 810 | prepare_to_wait(&port->delta_msr_wait, |
814 | &wait, TASK_INTERRUPTIBLE); | 811 | &wait, TASK_INTERRUPTIBLE); |
815 | schedule(); | 812 | schedule(); |
816 | finish_wait(&mct_u232_port->msr_wait, &wait); | 813 | finish_wait(&port->delta_msr_wait, &wait); |
817 | /* see if a signal did it */ | 814 | /* see if a signal did it */ |
818 | if (signal_pending(current)) | 815 | if (signal_pending(current)) |
819 | return -ERESTARTSYS; | 816 | return -ERESTARTSYS; |
817 | |||
818 | if (port->serial->disconnected) | ||
819 | return -EIO; | ||
820 | |||
820 | spin_lock_irqsave(&mct_u232_port->lock, flags); | 821 | spin_lock_irqsave(&mct_u232_port->lock, flags); |
821 | cnow = mct_u232_port->icount; | 822 | cnow = mct_u232_port->icount; |
822 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 823 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 809fb329eca5..b8051fa61911 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -219,7 +219,6 @@ struct moschip_port { | |||
219 | char open; | 219 | char open; |
220 | char open_ports; | 220 | char open_ports; |
221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
222 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
223 | int delta_msr_cond; | 222 | int delta_msr_cond; |
224 | struct async_icount icount; | 223 | struct async_icount icount; |
225 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 224 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
@@ -423,6 +422,9 @@ static void mos7840_handle_new_msr(struct moschip_port *port, __u8 new_msr) | |||
423 | icount->rng++; | 422 | icount->rng++; |
424 | smp_wmb(); | 423 | smp_wmb(); |
425 | } | 424 | } |
425 | |||
426 | mos7840_port->delta_msr_cond = 1; | ||
427 | wake_up_interruptible(&port->port->delta_msr_wait); | ||
426 | } | 428 | } |
427 | } | 429 | } |
428 | 430 | ||
@@ -1127,7 +1129,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1127 | 1129 | ||
1128 | /* initialize our wait queues */ | 1130 | /* initialize our wait queues */ |
1129 | init_waitqueue_head(&mos7840_port->wait_chase); | 1131 | init_waitqueue_head(&mos7840_port->wait_chase); |
1130 | init_waitqueue_head(&mos7840_port->delta_msr_wait); | ||
1131 | 1132 | ||
1132 | /* initialize our icount structure */ | 1133 | /* initialize our icount structure */ |
1133 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); | 1134 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); |
@@ -2017,8 +2018,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2017 | mos7840_port->read_urb_busy = false; | 2018 | mos7840_port->read_urb_busy = false; |
2018 | } | 2019 | } |
2019 | } | 2020 | } |
2020 | wake_up(&mos7840_port->delta_msr_wait); | ||
2021 | mos7840_port->delta_msr_cond = 1; | ||
2022 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, | 2021 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, |
2023 | mos7840_port->shadowLCR); | 2022 | mos7840_port->shadowLCR); |
2024 | } | 2023 | } |
@@ -2219,13 +2218,18 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
2219 | while (1) { | 2218 | while (1) { |
2220 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ | 2219 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ |
2221 | mos7840_port->delta_msr_cond = 0; | 2220 | mos7840_port->delta_msr_cond = 0; |
2222 | wait_event_interruptible(mos7840_port->delta_msr_wait, | 2221 | wait_event_interruptible(port->delta_msr_wait, |
2223 | (mos7840_port-> | 2222 | (port->serial->disconnected || |
2223 | mos7840_port-> | ||
2224 | delta_msr_cond == 1)); | 2224 | delta_msr_cond == 1)); |
2225 | 2225 | ||
2226 | /* see if a signal did it */ | 2226 | /* see if a signal did it */ |
2227 | if (signal_pending(current)) | 2227 | if (signal_pending(current)) |
2228 | return -ERESTARTSYS; | 2228 | return -ERESTARTSYS; |
2229 | |||
2230 | if (port->serial->disconnected) | ||
2231 | return -EIO; | ||
2232 | |||
2229 | cnow = mos7840_port->icount; | 2233 | cnow = mos7840_port->icount; |
2230 | smp_rmb(); | 2234 | smp_rmb(); |
2231 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2235 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f7d339d8187b..558adfc05007 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -341,6 +341,8 @@ static void option_instat_callback(struct urb *urb); | |||
341 | #define CINTERION_PRODUCT_EU3_E 0x0051 | 341 | #define CINTERION_PRODUCT_EU3_E 0x0051 |
342 | #define CINTERION_PRODUCT_EU3_P 0x0052 | 342 | #define CINTERION_PRODUCT_EU3_P 0x0052 |
343 | #define CINTERION_PRODUCT_PH8 0x0053 | 343 | #define CINTERION_PRODUCT_PH8 0x0053 |
344 | #define CINTERION_PRODUCT_AH6 0x0055 | ||
345 | #define CINTERION_PRODUCT_PLS8 0x0060 | ||
344 | 346 | ||
345 | /* Olivetti products */ | 347 | /* Olivetti products */ |
346 | #define OLIVETTI_VENDOR_ID 0x0b3c | 348 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -579,6 +581,7 @@ static const struct usb_device_id option_ids[] = { | |||
579 | { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), | 581 | { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), |
580 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 582 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
581 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) }, | 583 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) }, |
584 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) }, | ||
582 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, | 585 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, |
583 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), | 586 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), |
584 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, | 587 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, |
@@ -1260,6 +1263,8 @@ static const struct usb_device_id option_ids[] = { | |||
1260 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | 1263 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, |
1261 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | 1264 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, |
1262 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | 1265 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, |
1266 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, | ||
1267 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, | ||
1263 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | 1268 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
1264 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1269 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
1265 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | 1270 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index a958fd41b5b3..87c71ccfee87 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -188,7 +188,6 @@ struct oti6858_private { | |||
188 | u8 setup_done; | 188 | u8 setup_done; |
189 | struct delayed_work delayed_setup_work; | 189 | struct delayed_work delayed_setup_work; |
190 | 190 | ||
191 | wait_queue_head_t intr_wait; | ||
192 | struct usb_serial_port *port; /* USB port with which associated */ | 191 | struct usb_serial_port *port; /* USB port with which associated */ |
193 | }; | 192 | }; |
194 | 193 | ||
@@ -339,7 +338,6 @@ static int oti6858_port_probe(struct usb_serial_port *port) | |||
339 | return -ENOMEM; | 338 | return -ENOMEM; |
340 | 339 | ||
341 | spin_lock_init(&priv->lock); | 340 | spin_lock_init(&priv->lock); |
342 | init_waitqueue_head(&priv->intr_wait); | ||
343 | priv->port = port; | 341 | priv->port = port; |
344 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); | 342 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); |
345 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); | 343 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); |
@@ -664,11 +662,15 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
664 | spin_unlock_irqrestore(&priv->lock, flags); | 662 | spin_unlock_irqrestore(&priv->lock, flags); |
665 | 663 | ||
666 | while (1) { | 664 | while (1) { |
667 | wait_event_interruptible(priv->intr_wait, | 665 | wait_event_interruptible(port->delta_msr_wait, |
666 | port->serial->disconnected || | ||
668 | priv->status.pin_state != prev); | 667 | priv->status.pin_state != prev); |
669 | if (signal_pending(current)) | 668 | if (signal_pending(current)) |
670 | return -ERESTARTSYS; | 669 | return -ERESTARTSYS; |
671 | 670 | ||
671 | if (port->serial->disconnected) | ||
672 | return -EIO; | ||
673 | |||
672 | spin_lock_irqsave(&priv->lock, flags); | 674 | spin_lock_irqsave(&priv->lock, flags); |
673 | status = priv->status.pin_state & PIN_MASK; | 675 | status = priv->status.pin_state & PIN_MASK; |
674 | spin_unlock_irqrestore(&priv->lock, flags); | 676 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -763,7 +765,7 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
763 | 765 | ||
764 | if (!priv->transient) { | 766 | if (!priv->transient) { |
765 | if (xs->pin_state != priv->status.pin_state) | 767 | if (xs->pin_state != priv->status.pin_state) |
766 | wake_up_interruptible(&priv->intr_wait); | 768 | wake_up_interruptible(&port->delta_msr_wait); |
767 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); | 769 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); |
768 | } | 770 | } |
769 | 771 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 54adc9125e5c..3b10018d89a3 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -139,7 +139,6 @@ struct pl2303_serial_private { | |||
139 | 139 | ||
140 | struct pl2303_private { | 140 | struct pl2303_private { |
141 | spinlock_t lock; | 141 | spinlock_t lock; |
142 | wait_queue_head_t delta_msr_wait; | ||
143 | u8 line_control; | 142 | u8 line_control; |
144 | u8 line_status; | 143 | u8 line_status; |
145 | }; | 144 | }; |
@@ -233,7 +232,6 @@ static int pl2303_port_probe(struct usb_serial_port *port) | |||
233 | return -ENOMEM; | 232 | return -ENOMEM; |
234 | 233 | ||
235 | spin_lock_init(&priv->lock); | 234 | spin_lock_init(&priv->lock); |
236 | init_waitqueue_head(&priv->delta_msr_wait); | ||
237 | 235 | ||
238 | usb_set_serial_port_data(port, priv); | 236 | usb_set_serial_port_data(port, priv); |
239 | 237 | ||
@@ -607,11 +605,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
607 | spin_unlock_irqrestore(&priv->lock, flags); | 605 | spin_unlock_irqrestore(&priv->lock, flags); |
608 | 606 | ||
609 | while (1) { | 607 | while (1) { |
610 | interruptible_sleep_on(&priv->delta_msr_wait); | 608 | interruptible_sleep_on(&port->delta_msr_wait); |
611 | /* see if a signal did it */ | 609 | /* see if a signal did it */ |
612 | if (signal_pending(current)) | 610 | if (signal_pending(current)) |
613 | return -ERESTARTSYS; | 611 | return -ERESTARTSYS; |
614 | 612 | ||
613 | if (port->serial->disconnected) | ||
614 | return -EIO; | ||
615 | |||
615 | spin_lock_irqsave(&priv->lock, flags); | 616 | spin_lock_irqsave(&priv->lock, flags); |
616 | status = priv->line_status; | 617 | status = priv->line_status; |
617 | spin_unlock_irqrestore(&priv->lock, flags); | 618 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -719,7 +720,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
719 | spin_unlock_irqrestore(&priv->lock, flags); | 720 | spin_unlock_irqrestore(&priv->lock, flags); |
720 | if (priv->line_status & UART_BREAK_ERROR) | 721 | if (priv->line_status & UART_BREAK_ERROR) |
721 | usb_serial_handle_break(port); | 722 | usb_serial_handle_break(port); |
722 | wake_up_interruptible(&priv->delta_msr_wait); | 723 | wake_up_interruptible(&port->delta_msr_wait); |
723 | 724 | ||
724 | tty = tty_port_tty_get(&port->port); | 725 | tty = tty_port_tty_get(&port->port); |
725 | if (!tty) | 726 | if (!tty) |
@@ -783,7 +784,7 @@ static void pl2303_process_read_urb(struct urb *urb) | |||
783 | line_status = priv->line_status; | 784 | line_status = priv->line_status; |
784 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 785 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
785 | spin_unlock_irqrestore(&priv->lock, flags); | 786 | spin_unlock_irqrestore(&priv->lock, flags); |
786 | wake_up_interruptible(&priv->delta_msr_wait); | 787 | wake_up_interruptible(&port->delta_msr_wait); |
787 | 788 | ||
788 | if (!urb->actual_length) | 789 | if (!urb->actual_length) |
789 | return; | 790 | return; |
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c index 9b1b96f2d095..31f81c3c15eb 100644 --- a/drivers/usb/serial/qcaux.c +++ b/drivers/usb/serial/qcaux.c | |||
@@ -69,6 +69,7 @@ static struct usb_device_id id_table[] = { | |||
69 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ | 69 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ |
70 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ | 70 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ |
71 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ | 71 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ |
72 | { USB_DEVICE_AND_INTERFACE_INFO(0x1fac, 0x0151, 0xff, 0xff, 0xff) }, | ||
72 | { }, | 73 | { }, |
73 | }; | 74 | }; |
74 | MODULE_DEVICE_TABLE(usb, id_table); | 75 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 24662547dc5b..59b32b782126 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -197,12 +197,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
197 | 197 | ||
198 | if (is_gobi1k) { | 198 | if (is_gobi1k) { |
199 | /* Gobi 1K USB layout: | 199 | /* Gobi 1K USB layout: |
200 | * 0: serial port (doesn't respond) | 200 | * 0: DM/DIAG (use libqcdm from ModemManager for communication) |
201 | * 1: serial port (doesn't respond) | 201 | * 1: serial port (doesn't respond) |
202 | * 2: AT-capable modem port | 202 | * 2: AT-capable modem port |
203 | * 3: QMI/net | 203 | * 3: QMI/net |
204 | */ | 204 | */ |
205 | if (ifnum == 2) | 205 | if (ifnum == 0) { |
206 | dev_dbg(dev, "Gobi 1K DM/DIAG interface found\n"); | ||
207 | altsetting = 1; | ||
208 | } else if (ifnum == 2) | ||
206 | dev_dbg(dev, "Modem port found\n"); | 209 | dev_dbg(dev, "Modem port found\n"); |
207 | else | 210 | else |
208 | altsetting = -1; | 211 | altsetting = -1; |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 00e6c9bac8a3..75f125ddb0c9 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -128,7 +128,6 @@ struct qt2_port_private { | |||
128 | u8 shadowLSR; | 128 | u8 shadowLSR; |
129 | u8 shadowMSR; | 129 | u8 shadowMSR; |
130 | 130 | ||
131 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
132 | struct async_icount icount; | 131 | struct async_icount icount; |
133 | 132 | ||
134 | struct usb_serial_port *port; | 133 | struct usb_serial_port *port; |
@@ -506,8 +505,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
506 | spin_unlock_irqrestore(&priv->lock, flags); | 505 | spin_unlock_irqrestore(&priv->lock, flags); |
507 | 506 | ||
508 | while (1) { | 507 | while (1) { |
509 | wait_event_interruptible(priv->delta_msr_wait, | 508 | wait_event_interruptible(port->delta_msr_wait, |
510 | ((priv->icount.rng != prev.rng) || | 509 | (port->serial->disconnected || |
510 | (priv->icount.rng != prev.rng) || | ||
511 | (priv->icount.dsr != prev.dsr) || | 511 | (priv->icount.dsr != prev.dsr) || |
512 | (priv->icount.dcd != prev.dcd) || | 512 | (priv->icount.dcd != prev.dcd) || |
513 | (priv->icount.cts != prev.cts))); | 513 | (priv->icount.cts != prev.cts))); |
@@ -515,6 +515,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
515 | if (signal_pending(current)) | 515 | if (signal_pending(current)) |
516 | return -ERESTARTSYS; | 516 | return -ERESTARTSYS; |
517 | 517 | ||
518 | if (port->serial->disconnected) | ||
519 | return -EIO; | ||
520 | |||
518 | spin_lock_irqsave(&priv->lock, flags); | 521 | spin_lock_irqsave(&priv->lock, flags); |
519 | cur = priv->icount; | 522 | cur = priv->icount; |
520 | spin_unlock_irqrestore(&priv->lock, flags); | 523 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -661,7 +664,9 @@ void qt2_process_read_urb(struct urb *urb) | |||
661 | __func__); | 664 | __func__); |
662 | break; | 665 | break; |
663 | } | 666 | } |
664 | tty_flip_buffer_push(&port->port); | 667 | |
668 | if (port_priv->is_open) | ||
669 | tty_flip_buffer_push(&port->port); | ||
665 | 670 | ||
666 | newport = *(ch + 3); | 671 | newport = *(ch + 3); |
667 | 672 | ||
@@ -704,7 +709,8 @@ void qt2_process_read_urb(struct urb *urb) | |||
704 | tty_insert_flip_string(&port->port, ch, 1); | 709 | tty_insert_flip_string(&port->port, ch, 1); |
705 | } | 710 | } |
706 | 711 | ||
707 | tty_flip_buffer_push(&port->port); | 712 | if (port_priv->is_open) |
713 | tty_flip_buffer_push(&port->port); | ||
708 | } | 714 | } |
709 | 715 | ||
710 | static void qt2_write_bulk_callback(struct urb *urb) | 716 | static void qt2_write_bulk_callback(struct urb *urb) |
@@ -824,7 +830,6 @@ static int qt2_port_probe(struct usb_serial_port *port) | |||
824 | 830 | ||
825 | spin_lock_init(&port_priv->lock); | 831 | spin_lock_init(&port_priv->lock); |
826 | spin_lock_init(&port_priv->urb_lock); | 832 | spin_lock_init(&port_priv->urb_lock); |
827 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
828 | port_priv->port = port; | 833 | port_priv->port = port; |
829 | 834 | ||
830 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | 835 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); |
@@ -967,7 +972,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) | |||
967 | if (newMSR & UART_MSR_TERI) | 972 | if (newMSR & UART_MSR_TERI) |
968 | port_priv->icount.rng++; | 973 | port_priv->icount.rng++; |
969 | 974 | ||
970 | wake_up_interruptible(&port_priv->delta_msr_wait); | 975 | wake_up_interruptible(&port->delta_msr_wait); |
971 | } | 976 | } |
972 | } | 977 | } |
973 | 978 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 91ff8e3bddbd..549ef68ff5fa 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -149,7 +149,6 @@ enum spcp8x5_type { | |||
149 | struct spcp8x5_private { | 149 | struct spcp8x5_private { |
150 | spinlock_t lock; | 150 | spinlock_t lock; |
151 | enum spcp8x5_type type; | 151 | enum spcp8x5_type type; |
152 | wait_queue_head_t delta_msr_wait; | ||
153 | u8 line_control; | 152 | u8 line_control; |
154 | u8 line_status; | 153 | u8 line_status; |
155 | }; | 154 | }; |
@@ -179,7 +178,6 @@ static int spcp8x5_port_probe(struct usb_serial_port *port) | |||
179 | return -ENOMEM; | 178 | return -ENOMEM; |
180 | 179 | ||
181 | spin_lock_init(&priv->lock); | 180 | spin_lock_init(&priv->lock); |
182 | init_waitqueue_head(&priv->delta_msr_wait); | ||
183 | priv->type = type; | 181 | priv->type = type; |
184 | 182 | ||
185 | usb_set_serial_port_data(port , priv); | 183 | usb_set_serial_port_data(port , priv); |
@@ -475,7 +473,7 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
475 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 473 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
476 | spin_unlock_irqrestore(&priv->lock, flags); | 474 | spin_unlock_irqrestore(&priv->lock, flags); |
477 | /* wake up the wait for termios */ | 475 | /* wake up the wait for termios */ |
478 | wake_up_interruptible(&priv->delta_msr_wait); | 476 | wake_up_interruptible(&port->delta_msr_wait); |
479 | 477 | ||
480 | if (!urb->actual_length) | 478 | if (!urb->actual_length) |
481 | return; | 479 | return; |
@@ -526,12 +524,15 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port, | |||
526 | 524 | ||
527 | while (1) { | 525 | while (1) { |
528 | /* wake up in bulk read */ | 526 | /* wake up in bulk read */ |
529 | interruptible_sleep_on(&priv->delta_msr_wait); | 527 | interruptible_sleep_on(&port->delta_msr_wait); |
530 | 528 | ||
531 | /* see if a signal did it */ | 529 | /* see if a signal did it */ |
532 | if (signal_pending(current)) | 530 | if (signal_pending(current)) |
533 | return -ERESTARTSYS; | 531 | return -ERESTARTSYS; |
534 | 532 | ||
533 | if (port->serial->disconnected) | ||
534 | return -EIO; | ||
535 | |||
535 | spin_lock_irqsave(&priv->lock, flags); | 536 | spin_lock_irqsave(&priv->lock, flags); |
536 | status = priv->line_status; | 537 | status = priv->line_status; |
537 | spin_unlock_irqrestore(&priv->lock, flags); | 538 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index b57cf841c5b6..4b2a19757b4d 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -61,7 +61,6 @@ struct ssu100_port_private { | |||
61 | spinlock_t status_lock; | 61 | spinlock_t status_lock; |
62 | u8 shadowLSR; | 62 | u8 shadowLSR; |
63 | u8 shadowMSR; | 63 | u8 shadowMSR; |
64 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
65 | struct async_icount icount; | 64 | struct async_icount icount; |
66 | }; | 65 | }; |
67 | 66 | ||
@@ -355,8 +354,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
355 | spin_unlock_irqrestore(&priv->status_lock, flags); | 354 | spin_unlock_irqrestore(&priv->status_lock, flags); |
356 | 355 | ||
357 | while (1) { | 356 | while (1) { |
358 | wait_event_interruptible(priv->delta_msr_wait, | 357 | wait_event_interruptible(port->delta_msr_wait, |
359 | ((priv->icount.rng != prev.rng) || | 358 | (port->serial->disconnected || |
359 | (priv->icount.rng != prev.rng) || | ||
360 | (priv->icount.dsr != prev.dsr) || | 360 | (priv->icount.dsr != prev.dsr) || |
361 | (priv->icount.dcd != prev.dcd) || | 361 | (priv->icount.dcd != prev.dcd) || |
362 | (priv->icount.cts != prev.cts))); | 362 | (priv->icount.cts != prev.cts))); |
@@ -364,6 +364,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
364 | if (signal_pending(current)) | 364 | if (signal_pending(current)) |
365 | return -ERESTARTSYS; | 365 | return -ERESTARTSYS; |
366 | 366 | ||
367 | if (port->serial->disconnected) | ||
368 | return -EIO; | ||
369 | |||
367 | spin_lock_irqsave(&priv->status_lock, flags); | 370 | spin_lock_irqsave(&priv->status_lock, flags); |
368 | cur = priv->icount; | 371 | cur = priv->icount; |
369 | spin_unlock_irqrestore(&priv->status_lock, flags); | 372 | spin_unlock_irqrestore(&priv->status_lock, flags); |
@@ -445,7 +448,6 @@ static int ssu100_port_probe(struct usb_serial_port *port) | |||
445 | return -ENOMEM; | 448 | return -ENOMEM; |
446 | 449 | ||
447 | spin_lock_init(&priv->status_lock); | 450 | spin_lock_init(&priv->status_lock); |
448 | init_waitqueue_head(&priv->delta_msr_wait); | ||
449 | 451 | ||
450 | usb_set_serial_port_data(port, priv); | 452 | usb_set_serial_port_data(port, priv); |
451 | 453 | ||
@@ -537,7 +539,7 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) | |||
537 | priv->icount.dcd++; | 539 | priv->icount.dcd++; |
538 | if (msr & UART_MSR_TERI) | 540 | if (msr & UART_MSR_TERI) |
539 | priv->icount.rng++; | 541 | priv->icount.rng++; |
540 | wake_up_interruptible(&priv->delta_msr_wait); | 542 | wake_up_interruptible(&port->delta_msr_wait); |
541 | } | 543 | } |
542 | } | 544 | } |
543 | 545 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 39cb9b807c3c..73deb029fc05 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -74,7 +74,6 @@ struct ti_port { | |||
74 | int tp_flags; | 74 | int tp_flags; |
75 | int tp_closing_wait;/* in .01 secs */ | 75 | int tp_closing_wait;/* in .01 secs */ |
76 | struct async_icount tp_icount; | 76 | struct async_icount tp_icount; |
77 | wait_queue_head_t tp_msr_wait; /* wait for msr change */ | ||
78 | wait_queue_head_t tp_write_wait; | 77 | wait_queue_head_t tp_write_wait; |
79 | struct ti_device *tp_tdev; | 78 | struct ti_device *tp_tdev; |
80 | struct usb_serial_port *tp_port; | 79 | struct usb_serial_port *tp_port; |
@@ -432,7 +431,6 @@ static int ti_port_probe(struct usb_serial_port *port) | |||
432 | else | 431 | else |
433 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; | 432 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; |
434 | tport->tp_closing_wait = closing_wait; | 433 | tport->tp_closing_wait = closing_wait; |
435 | init_waitqueue_head(&tport->tp_msr_wait); | ||
436 | init_waitqueue_head(&tport->tp_write_wait); | 434 | init_waitqueue_head(&tport->tp_write_wait); |
437 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { | 435 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { |
438 | kfree(tport); | 436 | kfree(tport); |
@@ -784,9 +782,13 @@ static int ti_ioctl(struct tty_struct *tty, | |||
784 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 782 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
785 | cprev = tport->tp_icount; | 783 | cprev = tport->tp_icount; |
786 | while (1) { | 784 | while (1) { |
787 | interruptible_sleep_on(&tport->tp_msr_wait); | 785 | interruptible_sleep_on(&port->delta_msr_wait); |
788 | if (signal_pending(current)) | 786 | if (signal_pending(current)) |
789 | return -ERESTARTSYS; | 787 | return -ERESTARTSYS; |
788 | |||
789 | if (port->serial->disconnected) | ||
790 | return -EIO; | ||
791 | |||
790 | cnow = tport->tp_icount; | 792 | cnow = tport->tp_icount; |
791 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 793 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
792 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 794 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -1392,7 +1394,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
1392 | icount->dcd++; | 1394 | icount->dcd++; |
1393 | if (msr & TI_MSR_DELTA_RI) | 1395 | if (msr & TI_MSR_DELTA_RI) |
1394 | icount->rng++; | 1396 | icount->rng++; |
1395 | wake_up_interruptible(&tport->tp_msr_wait); | 1397 | wake_up_interruptible(&tport->tp_port->delta_msr_wait); |
1396 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1398 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1397 | } | 1399 | } |
1398 | 1400 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a19ed74d770d..5d9b178484fd 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -151,6 +151,7 @@ static void destroy_serial(struct kref *kref) | |||
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | usb_put_intf(serial->interface); | ||
154 | usb_put_dev(serial->dev); | 155 | usb_put_dev(serial->dev); |
155 | kfree(serial); | 156 | kfree(serial); |
156 | } | 157 | } |
@@ -620,7 +621,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, | |||
620 | } | 621 | } |
621 | serial->dev = usb_get_dev(dev); | 622 | serial->dev = usb_get_dev(dev); |
622 | serial->type = driver; | 623 | serial->type = driver; |
623 | serial->interface = interface; | 624 | serial->interface = usb_get_intf(interface); |
624 | kref_init(&serial->kref); | 625 | kref_init(&serial->kref); |
625 | mutex_init(&serial->disc_mutex); | 626 | mutex_init(&serial->disc_mutex); |
626 | serial->minor = SERIAL_TTY_NO_MINOR; | 627 | serial->minor = SERIAL_TTY_NO_MINOR; |
@@ -902,6 +903,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
902 | port->port.ops = &serial_port_ops; | 903 | port->port.ops = &serial_port_ops; |
903 | port->serial = serial; | 904 | port->serial = serial; |
904 | spin_lock_init(&port->lock); | 905 | spin_lock_init(&port->lock); |
906 | init_waitqueue_head(&port->delta_msr_wait); | ||
905 | /* Keep this for private driver use for the moment but | 907 | /* Keep this for private driver use for the moment but |
906 | should probably go away */ | 908 | should probably go away */ |
907 | INIT_WORK(&port->work, usb_serial_port_work); | 909 | INIT_WORK(&port->work, usb_serial_port_work); |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 7ab9046ae0ec..105d900150c1 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_data *us) | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | /* This places the HUAWEI usb dongles in multi-port mode */ | 95 | /* This places the HUAWEI E220 devices in multi-port mode */ |
96 | static int usb_stor_huawei_feature_init(struct us_data *us) | 96 | int usb_stor_huawei_e220_init(struct us_data *us) |
97 | { | 97 | { |
98 | int result; | 98 | int result; |
99 | 99 | ||
@@ -104,75 +104,3 @@ static int usb_stor_huawei_feature_init(struct us_data *us) | |||
104 | US_DEBUGP("Huawei mode set result is %d\n", result); | 104 | US_DEBUGP("Huawei mode set result is %d\n", result); |
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
107 | |||
108 | /* | ||
109 | * It will send a scsi switch command called rewind' to huawei dongle. | ||
110 | * When the dongle receives this command at the first time, | ||
111 | * it will reboot immediately. After rebooted, it will ignore this command. | ||
112 | * So it is unnecessary to read its response. | ||
113 | */ | ||
114 | static int usb_stor_huawei_scsi_init(struct us_data *us) | ||
115 | { | ||
116 | int result = 0; | ||
117 | int act_len = 0; | ||
118 | struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf; | ||
119 | char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, | ||
120 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
121 | |||
122 | bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN); | ||
123 | bcbw->Tag = 0; | ||
124 | bcbw->DataTransferLength = 0; | ||
125 | bcbw->Flags = bcbw->Lun = 0; | ||
126 | bcbw->Length = sizeof(rewind_cmd); | ||
127 | memset(bcbw->CDB, 0, sizeof(bcbw->CDB)); | ||
128 | memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd)); | ||
129 | |||
130 | result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw, | ||
131 | US_BULK_CB_WRAP_LEN, &act_len); | ||
132 | US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result); | ||
133 | return result; | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | * It tries to find the supported Huawei USB dongles. | ||
138 | * In Huawei, they assign the following product IDs | ||
139 | * for all of their mobile broadband dongles, | ||
140 | * including the new dongles in the future. | ||
141 | * So if the product ID is not included in this list, | ||
142 | * it means it is not Huawei's mobile broadband dongles. | ||
143 | */ | ||
144 | static int usb_stor_huawei_dongles_pid(struct us_data *us) | ||
145 | { | ||
146 | struct usb_interface_descriptor *idesc; | ||
147 | int idProduct; | ||
148 | |||
149 | idesc = &us->pusb_intf->cur_altsetting->desc; | ||
150 | idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct); | ||
151 | /* The first port is CDROM, | ||
152 | * means the dongle in the single port mode, | ||
153 | * and a switch command is required to be sent. */ | ||
154 | if (idesc && idesc->bInterfaceNumber == 0) { | ||
155 | if ((idProduct == 0x1001) | ||
156 | || (idProduct == 0x1003) | ||
157 | || (idProduct == 0x1004) | ||
158 | || (idProduct >= 0x1401 && idProduct <= 0x1500) | ||
159 | || (idProduct >= 0x1505 && idProduct <= 0x1600) | ||
160 | || (idProduct >= 0x1c02 && idProduct <= 0x2202)) { | ||
161 | return 1; | ||
162 | } | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | int usb_stor_huawei_init(struct us_data *us) | ||
168 | { | ||
169 | int result = 0; | ||
170 | |||
171 | if (usb_stor_huawei_dongles_pid(us)) { | ||
172 | if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446) | ||
173 | result = usb_stor_huawei_scsi_init(us); | ||
174 | else | ||
175 | result = usb_stor_huawei_feature_init(us); | ||
176 | } | ||
177 | return result; | ||
178 | } | ||
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index 5376d4fc76f0..529327fbb06b 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h | |||
@@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data *us); | |||
46 | * flash reader */ | 46 | * flash reader */ |
47 | int usb_stor_ucr61s2b_init(struct us_data *us); | 47 | int usb_stor_ucr61s2b_init(struct us_data *us); |
48 | 48 | ||
49 | /* This places the HUAWEI usb dongles in multi-port mode */ | 49 | /* This places the HUAWEI E220 devices in multi-port mode */ |
50 | int usb_stor_huawei_init(struct us_data *us); | 50 | int usb_stor_huawei_e220_init(struct us_data *us); |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 72923b56bbf6..1799335288bd 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -53,6 +53,14 @@ | |||
53 | * as opposed to devices that do something strangely or wrongly. | 53 | * as opposed to devices that do something strangely or wrongly. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | /* In-kernel mode switching is deprecated. Do not add new devices to | ||
57 | * this list for the sole purpose of switching them to a different | ||
58 | * mode. Existing userspace solutions are superior. | ||
59 | * | ||
60 | * New mode switching devices should instead be added to the database | ||
61 | * maintained at http://www.draisberghof.de/usb_modeswitch/ | ||
62 | */ | ||
63 | |||
56 | #if !defined(CONFIG_USB_STORAGE_SDDR09) && \ | 64 | #if !defined(CONFIG_USB_STORAGE_SDDR09) && \ |
57 | !defined(CONFIG_USB_STORAGE_SDDR09_MODULE) | 65 | !defined(CONFIG_USB_STORAGE_SDDR09_MODULE) |
58 | #define NO_SDDR09 | 66 | #define NO_SDDR09 |
@@ -488,6 +496,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, | |||
488 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 496 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
489 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), | 497 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
490 | 498 | ||
499 | /* Added by Dmitry Artamonow <mad_soft@inbox.ru> */ | ||
500 | UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, | ||
501 | "Samsung", | ||
502 | "YP-Z3", | ||
503 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
504 | US_FL_MAX_SECTORS_64), | ||
505 | |||
491 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. | 506 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. |
492 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and | 507 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
493 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. | 508 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
@@ -1527,10 +1542,335 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100, | |||
1527 | /* Reported by fangxiaozhi <huananhu@huawei.com> | 1542 | /* Reported by fangxiaozhi <huananhu@huawei.com> |
1528 | * This brings the HUAWEI data card devices into multi-port mode | 1543 | * This brings the HUAWEI data card devices into multi-port mode |
1529 | */ | 1544 | */ |
1530 | UNUSUAL_VENDOR_INTF(0x12d1, 0x08, 0x06, 0x50, | 1545 | UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000, |
1546 | "HUAWEI MOBILE", | ||
1547 | "Mass Storage", | ||
1548 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1549 | 0), | ||
1550 | UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000, | ||
1551 | "HUAWEI MOBILE", | ||
1552 | "Mass Storage", | ||
1553 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1554 | 0), | ||
1555 | UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000, | ||
1556 | "HUAWEI MOBILE", | ||
1557 | "Mass Storage", | ||
1558 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1559 | 0), | ||
1560 | UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000, | ||
1561 | "HUAWEI MOBILE", | ||
1562 | "Mass Storage", | ||
1563 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1564 | 0), | ||
1565 | UNUSUAL_DEV( 0x12d1, 0x1402, 0x0000, 0x0000, | ||
1566 | "HUAWEI MOBILE", | ||
1567 | "Mass Storage", | ||
1568 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1569 | 0), | ||
1570 | UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000, | ||
1571 | "HUAWEI MOBILE", | ||
1572 | "Mass Storage", | ||
1573 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1574 | 0), | ||
1575 | UNUSUAL_DEV( 0x12d1, 0x1404, 0x0000, 0x0000, | ||
1576 | "HUAWEI MOBILE", | ||
1577 | "Mass Storage", | ||
1578 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1579 | 0), | ||
1580 | UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000, | ||
1581 | "HUAWEI MOBILE", | ||
1582 | "Mass Storage", | ||
1583 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1584 | 0), | ||
1585 | UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000, | ||
1586 | "HUAWEI MOBILE", | ||
1587 | "Mass Storage", | ||
1588 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1589 | 0), | ||
1590 | UNUSUAL_DEV( 0x12d1, 0x1407, 0x0000, 0x0000, | ||
1591 | "HUAWEI MOBILE", | ||
1592 | "Mass Storage", | ||
1593 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1594 | 0), | ||
1595 | UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000, | ||
1596 | "HUAWEI MOBILE", | ||
1597 | "Mass Storage", | ||
1598 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1599 | 0), | ||
1600 | UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000, | ||
1601 | "HUAWEI MOBILE", | ||
1602 | "Mass Storage", | ||
1603 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1604 | 0), | ||
1605 | UNUSUAL_DEV( 0x12d1, 0x140A, 0x0000, 0x0000, | ||
1606 | "HUAWEI MOBILE", | ||
1607 | "Mass Storage", | ||
1608 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1609 | 0), | ||
1610 | UNUSUAL_DEV( 0x12d1, 0x140B, 0x0000, 0x0000, | ||
1611 | "HUAWEI MOBILE", | ||
1612 | "Mass Storage", | ||
1613 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1614 | 0), | ||
1615 | UNUSUAL_DEV( 0x12d1, 0x140C, 0x0000, 0x0000, | ||
1616 | "HUAWEI MOBILE", | ||
1617 | "Mass Storage", | ||
1618 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1619 | 0), | ||
1620 | UNUSUAL_DEV( 0x12d1, 0x140D, 0x0000, 0x0000, | ||
1621 | "HUAWEI MOBILE", | ||
1622 | "Mass Storage", | ||
1623 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1624 | 0), | ||
1625 | UNUSUAL_DEV( 0x12d1, 0x140E, 0x0000, 0x0000, | ||
1626 | "HUAWEI MOBILE", | ||
1627 | "Mass Storage", | ||
1628 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1629 | 0), | ||
1630 | UNUSUAL_DEV( 0x12d1, 0x140F, 0x0000, 0x0000, | ||
1631 | "HUAWEI MOBILE", | ||
1632 | "Mass Storage", | ||
1633 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1634 | 0), | ||
1635 | UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000, | ||
1636 | "HUAWEI MOBILE", | ||
1637 | "Mass Storage", | ||
1638 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1639 | 0), | ||
1640 | UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000, | ||
1641 | "HUAWEI MOBILE", | ||
1642 | "Mass Storage", | ||
1643 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1644 | 0), | ||
1645 | UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000, | ||
1646 | "HUAWEI MOBILE", | ||
1647 | "Mass Storage", | ||
1648 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1649 | 0), | ||
1650 | UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000, | ||
1651 | "HUAWEI MOBILE", | ||
1652 | "Mass Storage", | ||
1653 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1654 | 0), | ||
1655 | UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000, | ||
1656 | "HUAWEI MOBILE", | ||
1657 | "Mass Storage", | ||
1658 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1659 | 0), | ||
1660 | UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000, | ||
1661 | "HUAWEI MOBILE", | ||
1662 | "Mass Storage", | ||
1663 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1664 | 0), | ||
1665 | UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000, | ||
1666 | "HUAWEI MOBILE", | ||
1667 | "Mass Storage", | ||
1668 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1669 | 0), | ||
1670 | UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000, | ||
1671 | "HUAWEI MOBILE", | ||
1672 | "Mass Storage", | ||
1673 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1674 | 0), | ||
1675 | UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000, | ||
1676 | "HUAWEI MOBILE", | ||
1677 | "Mass Storage", | ||
1678 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1679 | 0), | ||
1680 | UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000, | ||
1681 | "HUAWEI MOBILE", | ||
1682 | "Mass Storage", | ||
1683 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1684 | 0), | ||
1685 | UNUSUAL_DEV( 0x12d1, 0x141A, 0x0000, 0x0000, | ||
1686 | "HUAWEI MOBILE", | ||
1687 | "Mass Storage", | ||
1688 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1689 | 0), | ||
1690 | UNUSUAL_DEV( 0x12d1, 0x141B, 0x0000, 0x0000, | ||
1691 | "HUAWEI MOBILE", | ||
1692 | "Mass Storage", | ||
1693 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1694 | 0), | ||
1695 | UNUSUAL_DEV( 0x12d1, 0x141C, 0x0000, 0x0000, | ||
1696 | "HUAWEI MOBILE", | ||
1697 | "Mass Storage", | ||
1698 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1699 | 0), | ||
1700 | UNUSUAL_DEV( 0x12d1, 0x141D, 0x0000, 0x0000, | ||
1701 | "HUAWEI MOBILE", | ||
1702 | "Mass Storage", | ||
1703 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1704 | 0), | ||
1705 | UNUSUAL_DEV( 0x12d1, 0x141E, 0x0000, 0x0000, | ||
1706 | "HUAWEI MOBILE", | ||
1707 | "Mass Storage", | ||
1708 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1709 | 0), | ||
1710 | UNUSUAL_DEV( 0x12d1, 0x141F, 0x0000, 0x0000, | ||
1711 | "HUAWEI MOBILE", | ||
1712 | "Mass Storage", | ||
1713 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1714 | 0), | ||
1715 | UNUSUAL_DEV( 0x12d1, 0x1420, 0x0000, 0x0000, | ||
1716 | "HUAWEI MOBILE", | ||
1717 | "Mass Storage", | ||
1718 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1719 | 0), | ||
1720 | UNUSUAL_DEV( 0x12d1, 0x1421, 0x0000, 0x0000, | ||
1721 | "HUAWEI MOBILE", | ||
1722 | "Mass Storage", | ||
1723 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1724 | 0), | ||
1725 | UNUSUAL_DEV( 0x12d1, 0x1422, 0x0000, 0x0000, | ||
1726 | "HUAWEI MOBILE", | ||
1727 | "Mass Storage", | ||
1728 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1729 | 0), | ||
1730 | UNUSUAL_DEV( 0x12d1, 0x1423, 0x0000, 0x0000, | ||
1731 | "HUAWEI MOBILE", | ||
1732 | "Mass Storage", | ||
1733 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1734 | 0), | ||
1735 | UNUSUAL_DEV( 0x12d1, 0x1424, 0x0000, 0x0000, | ||
1736 | "HUAWEI MOBILE", | ||
1737 | "Mass Storage", | ||
1738 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1739 | 0), | ||
1740 | UNUSUAL_DEV( 0x12d1, 0x1425, 0x0000, 0x0000, | ||
1741 | "HUAWEI MOBILE", | ||
1742 | "Mass Storage", | ||
1743 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1744 | 0), | ||
1745 | UNUSUAL_DEV( 0x12d1, 0x1426, 0x0000, 0x0000, | ||
1746 | "HUAWEI MOBILE", | ||
1747 | "Mass Storage", | ||
1748 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1749 | 0), | ||
1750 | UNUSUAL_DEV( 0x12d1, 0x1427, 0x0000, 0x0000, | ||
1751 | "HUAWEI MOBILE", | ||
1752 | "Mass Storage", | ||
1753 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1754 | 0), | ||
1755 | UNUSUAL_DEV( 0x12d1, 0x1428, 0x0000, 0x0000, | ||
1756 | "HUAWEI MOBILE", | ||
1757 | "Mass Storage", | ||
1758 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1759 | 0), | ||
1760 | UNUSUAL_DEV( 0x12d1, 0x1429, 0x0000, 0x0000, | ||
1761 | "HUAWEI MOBILE", | ||
1762 | "Mass Storage", | ||
1763 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1764 | 0), | ||
1765 | UNUSUAL_DEV( 0x12d1, 0x142A, 0x0000, 0x0000, | ||
1766 | "HUAWEI MOBILE", | ||
1767 | "Mass Storage", | ||
1768 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1769 | 0), | ||
1770 | UNUSUAL_DEV( 0x12d1, 0x142B, 0x0000, 0x0000, | ||
1771 | "HUAWEI MOBILE", | ||
1772 | "Mass Storage", | ||
1773 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1774 | 0), | ||
1775 | UNUSUAL_DEV( 0x12d1, 0x142C, 0x0000, 0x0000, | ||
1776 | "HUAWEI MOBILE", | ||
1777 | "Mass Storage", | ||
1778 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1779 | 0), | ||
1780 | UNUSUAL_DEV( 0x12d1, 0x142D, 0x0000, 0x0000, | ||
1781 | "HUAWEI MOBILE", | ||
1782 | "Mass Storage", | ||
1783 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1784 | 0), | ||
1785 | UNUSUAL_DEV( 0x12d1, 0x142E, 0x0000, 0x0000, | ||
1786 | "HUAWEI MOBILE", | ||
1787 | "Mass Storage", | ||
1788 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1789 | 0), | ||
1790 | UNUSUAL_DEV( 0x12d1, 0x142F, 0x0000, 0x0000, | ||
1791 | "HUAWEI MOBILE", | ||
1792 | "Mass Storage", | ||
1793 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1794 | 0), | ||
1795 | UNUSUAL_DEV( 0x12d1, 0x1430, 0x0000, 0x0000, | ||
1796 | "HUAWEI MOBILE", | ||
1797 | "Mass Storage", | ||
1798 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1799 | 0), | ||
1800 | UNUSUAL_DEV( 0x12d1, 0x1431, 0x0000, 0x0000, | ||
1801 | "HUAWEI MOBILE", | ||
1802 | "Mass Storage", | ||
1803 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1804 | 0), | ||
1805 | UNUSUAL_DEV( 0x12d1, 0x1432, 0x0000, 0x0000, | ||
1806 | "HUAWEI MOBILE", | ||
1807 | "Mass Storage", | ||
1808 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1809 | 0), | ||
1810 | UNUSUAL_DEV( 0x12d1, 0x1433, 0x0000, 0x0000, | ||
1811 | "HUAWEI MOBILE", | ||
1812 | "Mass Storage", | ||
1813 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1814 | 0), | ||
1815 | UNUSUAL_DEV( 0x12d1, 0x1434, 0x0000, 0x0000, | ||
1816 | "HUAWEI MOBILE", | ||
1817 | "Mass Storage", | ||
1818 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1819 | 0), | ||
1820 | UNUSUAL_DEV( 0x12d1, 0x1435, 0x0000, 0x0000, | ||
1821 | "HUAWEI MOBILE", | ||
1822 | "Mass Storage", | ||
1823 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1824 | 0), | ||
1825 | UNUSUAL_DEV( 0x12d1, 0x1436, 0x0000, 0x0000, | ||
1826 | "HUAWEI MOBILE", | ||
1827 | "Mass Storage", | ||
1828 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1829 | 0), | ||
1830 | UNUSUAL_DEV( 0x12d1, 0x1437, 0x0000, 0x0000, | ||
1831 | "HUAWEI MOBILE", | ||
1832 | "Mass Storage", | ||
1833 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1834 | 0), | ||
1835 | UNUSUAL_DEV( 0x12d1, 0x1438, 0x0000, 0x0000, | ||
1836 | "HUAWEI MOBILE", | ||
1837 | "Mass Storage", | ||
1838 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1839 | 0), | ||
1840 | UNUSUAL_DEV( 0x12d1, 0x1439, 0x0000, 0x0000, | ||
1841 | "HUAWEI MOBILE", | ||
1842 | "Mass Storage", | ||
1843 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1844 | 0), | ||
1845 | UNUSUAL_DEV( 0x12d1, 0x143A, 0x0000, 0x0000, | ||
1846 | "HUAWEI MOBILE", | ||
1847 | "Mass Storage", | ||
1848 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1849 | 0), | ||
1850 | UNUSUAL_DEV( 0x12d1, 0x143B, 0x0000, 0x0000, | ||
1851 | "HUAWEI MOBILE", | ||
1852 | "Mass Storage", | ||
1853 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1854 | 0), | ||
1855 | UNUSUAL_DEV( 0x12d1, 0x143C, 0x0000, 0x0000, | ||
1856 | "HUAWEI MOBILE", | ||
1857 | "Mass Storage", | ||
1858 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1859 | 0), | ||
1860 | UNUSUAL_DEV( 0x12d1, 0x143D, 0x0000, 0x0000, | ||
1861 | "HUAWEI MOBILE", | ||
1862 | "Mass Storage", | ||
1863 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1864 | 0), | ||
1865 | UNUSUAL_DEV( 0x12d1, 0x143E, 0x0000, 0x0000, | ||
1866 | "HUAWEI MOBILE", | ||
1867 | "Mass Storage", | ||
1868 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1869 | 0), | ||
1870 | UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000, | ||
1531 | "HUAWEI MOBILE", | 1871 | "HUAWEI MOBILE", |
1532 | "Mass Storage", | 1872 | "Mass Storage", |
1533 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_init, | 1873 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, |
1534 | 0), | 1874 | 0), |
1535 | 1875 | ||
1536 | /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ | 1876 | /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ |
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 8189cb6a86af..7abc5c81af2c 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -346,6 +346,7 @@ static long vfio_pci_ioctl(void *device_data, | |||
346 | 346 | ||
347 | if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) { | 347 | if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) { |
348 | size_t size; | 348 | size_t size; |
349 | int max = vfio_pci_get_irq_count(vdev, hdr.index); | ||
349 | 350 | ||
350 | if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL) | 351 | if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL) |
351 | size = sizeof(uint8_t); | 352 | size = sizeof(uint8_t); |
@@ -355,7 +356,7 @@ static long vfio_pci_ioctl(void *device_data, | |||
355 | return -EINVAL; | 356 | return -EINVAL; |
356 | 357 | ||
357 | if (hdr.argsz - minsz < hdr.count * size || | 358 | if (hdr.argsz - minsz < hdr.count * size || |
358 | hdr.count > vfio_pci_get_irq_count(vdev, hdr.index)) | 359 | hdr.start >= max || hdr.start + hdr.count > max) |
359 | return -EINVAL; | 360 | return -EINVAL; |
360 | 361 | ||
361 | data = memdup_user((void __user *)(arg + minsz), | 362 | data = memdup_user((void __user *)(arg + minsz), |
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 964ff22bf281..aeb00fc2d3be 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | #include <linux/vfio.h> | 29 | #include <linux/vfio.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include "vfio_pci_private.h" | 32 | #include "vfio_pci_private.h" |
32 | 33 | ||
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 3639371fa697..a96509187deb 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/vfio.h> | 22 | #include <linux/vfio.h> |
23 | #include <linux/wait.h> | 23 | #include <linux/wait.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include "vfio_pci_private.h" | 27 | #include "vfio_pci_private.h" |
27 | 28 | ||
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 959b1cd89e6a..ec6fb3fa59bb 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -339,7 +339,8 @@ static void handle_tx(struct vhost_net *net) | |||
339 | msg.msg_controllen = 0; | 339 | msg.msg_controllen = 0; |
340 | ubufs = NULL; | 340 | ubufs = NULL; |
341 | } else { | 341 | } else { |
342 | struct ubuf_info *ubuf = &vq->ubuf_info[head]; | 342 | struct ubuf_info *ubuf; |
343 | ubuf = vq->ubuf_info + vq->upend_idx; | ||
343 | 344 | ||
344 | vq->heads[vq->upend_idx].len = | 345 | vq->heads[vq->upend_idx].len = |
345 | VHOST_DMA_IN_PROGRESS; | 346 | VHOST_DMA_IN_PROGRESS; |
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 9951297b2427..957a0b98a5d9 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
@@ -60,14 +60,22 @@ enum { | |||
60 | VHOST_SCSI_VQ_IO = 2, | 60 | VHOST_SCSI_VQ_IO = 2, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* | ||
64 | * VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in | ||
65 | * kernel but disabling it helps. | ||
66 | * TODO: debug and remove the workaround. | ||
67 | */ | ||
68 | enum { | ||
69 | VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX) | ||
70 | }; | ||
71 | |||
63 | #define VHOST_SCSI_MAX_TARGET 256 | 72 | #define VHOST_SCSI_MAX_TARGET 256 |
64 | #define VHOST_SCSI_MAX_VQ 128 | 73 | #define VHOST_SCSI_MAX_VQ 128 |
65 | 74 | ||
66 | struct vhost_scsi { | 75 | struct vhost_scsi { |
67 | /* Protected by vhost_scsi->dev.mutex */ | 76 | /* Protected by vhost_scsi->dev.mutex */ |
68 | struct tcm_vhost_tpg *vs_tpg[VHOST_SCSI_MAX_TARGET]; | 77 | struct tcm_vhost_tpg **vs_tpg; |
69 | char vs_vhost_wwpn[TRANSPORT_IQN_LEN]; | 78 | char vs_vhost_wwpn[TRANSPORT_IQN_LEN]; |
70 | bool vs_endpoint; | ||
71 | 79 | ||
72 | struct vhost_dev dev; | 80 | struct vhost_dev dev; |
73 | struct vhost_virtqueue vqs[VHOST_SCSI_MAX_VQ]; | 81 | struct vhost_virtqueue vqs[VHOST_SCSI_MAX_VQ]; |
@@ -570,9 +578,27 @@ static void tcm_vhost_submission_work(struct work_struct *work) | |||
570 | } | 578 | } |
571 | } | 579 | } |
572 | 580 | ||
581 | static void vhost_scsi_send_bad_target(struct vhost_scsi *vs, | ||
582 | struct vhost_virtqueue *vq, int head, unsigned out) | ||
583 | { | ||
584 | struct virtio_scsi_cmd_resp __user *resp; | ||
585 | struct virtio_scsi_cmd_resp rsp; | ||
586 | int ret; | ||
587 | |||
588 | memset(&rsp, 0, sizeof(rsp)); | ||
589 | rsp.response = VIRTIO_SCSI_S_BAD_TARGET; | ||
590 | resp = vq->iov[out].iov_base; | ||
591 | ret = __copy_to_user(resp, &rsp, sizeof(rsp)); | ||
592 | if (!ret) | ||
593 | vhost_add_used_and_signal(&vs->dev, vq, head, 0); | ||
594 | else | ||
595 | pr_err("Faulted on virtio_scsi_cmd_resp\n"); | ||
596 | } | ||
597 | |||
573 | static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | 598 | static void vhost_scsi_handle_vq(struct vhost_scsi *vs, |
574 | struct vhost_virtqueue *vq) | 599 | struct vhost_virtqueue *vq) |
575 | { | 600 | { |
601 | struct tcm_vhost_tpg **vs_tpg; | ||
576 | struct virtio_scsi_cmd_req v_req; | 602 | struct virtio_scsi_cmd_req v_req; |
577 | struct tcm_vhost_tpg *tv_tpg; | 603 | struct tcm_vhost_tpg *tv_tpg; |
578 | struct tcm_vhost_cmd *tv_cmd; | 604 | struct tcm_vhost_cmd *tv_cmd; |
@@ -581,8 +607,16 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
581 | int head, ret; | 607 | int head, ret; |
582 | u8 target; | 608 | u8 target; |
583 | 609 | ||
584 | /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */ | 610 | /* |
585 | if (unlikely(!vs->vs_endpoint)) | 611 | * We can handle the vq only after the endpoint is setup by calling the |
612 | * VHOST_SCSI_SET_ENDPOINT ioctl. | ||
613 | * | ||
614 | * TODO: Check that we are running from vhost_worker which acts | ||
615 | * as read-side critical section for vhost kind of RCU. | ||
616 | * See the comments in struct vhost_virtqueue in drivers/vhost/vhost.h | ||
617 | */ | ||
618 | vs_tpg = rcu_dereference_check(vq->private_data, 1); | ||
619 | if (!vs_tpg) | ||
586 | return; | 620 | return; |
587 | 621 | ||
588 | mutex_lock(&vq->mutex); | 622 | mutex_lock(&vq->mutex); |
@@ -652,23 +686,11 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
652 | 686 | ||
653 | /* Extract the tpgt */ | 687 | /* Extract the tpgt */ |
654 | target = v_req.lun[1]; | 688 | target = v_req.lun[1]; |
655 | tv_tpg = vs->vs_tpg[target]; | 689 | tv_tpg = ACCESS_ONCE(vs_tpg[target]); |
656 | 690 | ||
657 | /* Target does not exist, fail the request */ | 691 | /* Target does not exist, fail the request */ |
658 | if (unlikely(!tv_tpg)) { | 692 | if (unlikely(!tv_tpg)) { |
659 | struct virtio_scsi_cmd_resp __user *resp; | 693 | vhost_scsi_send_bad_target(vs, vq, head, out); |
660 | struct virtio_scsi_cmd_resp rsp; | ||
661 | |||
662 | memset(&rsp, 0, sizeof(rsp)); | ||
663 | rsp.response = VIRTIO_SCSI_S_BAD_TARGET; | ||
664 | resp = vq->iov[out].iov_base; | ||
665 | ret = __copy_to_user(resp, &rsp, sizeof(rsp)); | ||
666 | if (!ret) | ||
667 | vhost_add_used_and_signal(&vs->dev, | ||
668 | vq, head, 0); | ||
669 | else | ||
670 | pr_err("Faulted on virtio_scsi_cmd_resp\n"); | ||
671 | |||
672 | continue; | 694 | continue; |
673 | } | 695 | } |
674 | 696 | ||
@@ -681,22 +703,13 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
681 | if (IS_ERR(tv_cmd)) { | 703 | if (IS_ERR(tv_cmd)) { |
682 | vq_err(vq, "vhost_scsi_allocate_cmd failed %ld\n", | 704 | vq_err(vq, "vhost_scsi_allocate_cmd failed %ld\n", |
683 | PTR_ERR(tv_cmd)); | 705 | PTR_ERR(tv_cmd)); |
684 | break; | 706 | goto err_cmd; |
685 | } | 707 | } |
686 | pr_debug("Allocated tv_cmd: %p exp_data_len: %d, data_direction" | 708 | pr_debug("Allocated tv_cmd: %p exp_data_len: %d, data_direction" |
687 | ": %d\n", tv_cmd, exp_data_len, data_direction); | 709 | ": %d\n", tv_cmd, exp_data_len, data_direction); |
688 | 710 | ||
689 | tv_cmd->tvc_vhost = vs; | 711 | tv_cmd->tvc_vhost = vs; |
690 | tv_cmd->tvc_vq = vq; | 712 | tv_cmd->tvc_vq = vq; |
691 | |||
692 | if (unlikely(vq->iov[out].iov_len != | ||
693 | sizeof(struct virtio_scsi_cmd_resp))) { | ||
694 | vq_err(vq, "Expecting virtio_scsi_cmd_resp, got %zu" | ||
695 | " bytes, out: %d, in: %d\n", | ||
696 | vq->iov[out].iov_len, out, in); | ||
697 | break; | ||
698 | } | ||
699 | |||
700 | tv_cmd->tvc_resp = vq->iov[out].iov_base; | 713 | tv_cmd->tvc_resp = vq->iov[out].iov_base; |
701 | 714 | ||
702 | /* | 715 | /* |
@@ -716,7 +729,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
716 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", | 729 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", |
717 | scsi_command_size(tv_cmd->tvc_cdb), | 730 | scsi_command_size(tv_cmd->tvc_cdb), |
718 | TCM_VHOST_MAX_CDB_SIZE); | 731 | TCM_VHOST_MAX_CDB_SIZE); |
719 | break; /* TODO */ | 732 | goto err_free; |
720 | } | 733 | } |
721 | tv_cmd->tvc_lun = ((v_req.lun[2] << 8) | v_req.lun[3]) & 0x3FFF; | 734 | tv_cmd->tvc_lun = ((v_req.lun[2] << 8) | v_req.lun[3]) & 0x3FFF; |
722 | 735 | ||
@@ -729,7 +742,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
729 | data_direction == DMA_TO_DEVICE); | 742 | data_direction == DMA_TO_DEVICE); |
730 | if (unlikely(ret)) { | 743 | if (unlikely(ret)) { |
731 | vq_err(vq, "Failed to map iov to sgl\n"); | 744 | vq_err(vq, "Failed to map iov to sgl\n"); |
732 | break; /* TODO */ | 745 | goto err_free; |
733 | } | 746 | } |
734 | } | 747 | } |
735 | 748 | ||
@@ -750,6 +763,13 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
750 | } | 763 | } |
751 | 764 | ||
752 | mutex_unlock(&vq->mutex); | 765 | mutex_unlock(&vq->mutex); |
766 | return; | ||
767 | |||
768 | err_free: | ||
769 | vhost_scsi_free_cmd(tv_cmd); | ||
770 | err_cmd: | ||
771 | vhost_scsi_send_bad_target(vs, vq, head, out); | ||
772 | mutex_unlock(&vq->mutex); | ||
753 | } | 773 | } |
754 | 774 | ||
755 | static void vhost_scsi_ctl_handle_kick(struct vhost_work *work) | 775 | static void vhost_scsi_ctl_handle_kick(struct vhost_work *work) |
@@ -771,6 +791,20 @@ static void vhost_scsi_handle_kick(struct vhost_work *work) | |||
771 | vhost_scsi_handle_vq(vs, vq); | 791 | vhost_scsi_handle_vq(vs, vq); |
772 | } | 792 | } |
773 | 793 | ||
794 | static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index) | ||
795 | { | ||
796 | vhost_poll_flush(&vs->dev.vqs[index].poll); | ||
797 | } | ||
798 | |||
799 | static void vhost_scsi_flush(struct vhost_scsi *vs) | ||
800 | { | ||
801 | int i; | ||
802 | |||
803 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | ||
804 | vhost_scsi_flush_vq(vs, i); | ||
805 | vhost_work_flush(&vs->dev, &vs->vs_completion_work); | ||
806 | } | ||
807 | |||
774 | /* | 808 | /* |
775 | * Called from vhost_scsi_ioctl() context to walk the list of available | 809 | * Called from vhost_scsi_ioctl() context to walk the list of available |
776 | * tcm_vhost_tpg with an active struct tcm_vhost_nexus | 810 | * tcm_vhost_tpg with an active struct tcm_vhost_nexus |
@@ -781,8 +815,10 @@ static int vhost_scsi_set_endpoint( | |||
781 | { | 815 | { |
782 | struct tcm_vhost_tport *tv_tport; | 816 | struct tcm_vhost_tport *tv_tport; |
783 | struct tcm_vhost_tpg *tv_tpg; | 817 | struct tcm_vhost_tpg *tv_tpg; |
818 | struct tcm_vhost_tpg **vs_tpg; | ||
819 | struct vhost_virtqueue *vq; | ||
820 | int index, ret, i, len; | ||
784 | bool match = false; | 821 | bool match = false; |
785 | int index, ret; | ||
786 | 822 | ||
787 | mutex_lock(&vs->dev.mutex); | 823 | mutex_lock(&vs->dev.mutex); |
788 | /* Verify that ring has been setup correctly. */ | 824 | /* Verify that ring has been setup correctly. */ |
@@ -794,6 +830,15 @@ static int vhost_scsi_set_endpoint( | |||
794 | } | 830 | } |
795 | } | 831 | } |
796 | 832 | ||
833 | len = sizeof(vs_tpg[0]) * VHOST_SCSI_MAX_TARGET; | ||
834 | vs_tpg = kzalloc(len, GFP_KERNEL); | ||
835 | if (!vs_tpg) { | ||
836 | mutex_unlock(&vs->dev.mutex); | ||
837 | return -ENOMEM; | ||
838 | } | ||
839 | if (vs->vs_tpg) | ||
840 | memcpy(vs_tpg, vs->vs_tpg, len); | ||
841 | |||
797 | mutex_lock(&tcm_vhost_mutex); | 842 | mutex_lock(&tcm_vhost_mutex); |
798 | list_for_each_entry(tv_tpg, &tcm_vhost_list, tv_tpg_list) { | 843 | list_for_each_entry(tv_tpg, &tcm_vhost_list, tv_tpg_list) { |
799 | mutex_lock(&tv_tpg->tv_tpg_mutex); | 844 | mutex_lock(&tv_tpg->tv_tpg_mutex); |
@@ -808,14 +853,15 @@ static int vhost_scsi_set_endpoint( | |||
808 | tv_tport = tv_tpg->tport; | 853 | tv_tport = tv_tpg->tport; |
809 | 854 | ||
810 | if (!strcmp(tv_tport->tport_name, t->vhost_wwpn)) { | 855 | if (!strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
811 | if (vs->vs_tpg[tv_tpg->tport_tpgt]) { | 856 | if (vs->vs_tpg && vs->vs_tpg[tv_tpg->tport_tpgt]) { |
812 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | 857 | mutex_unlock(&tv_tpg->tv_tpg_mutex); |
813 | mutex_unlock(&tcm_vhost_mutex); | 858 | mutex_unlock(&tcm_vhost_mutex); |
814 | mutex_unlock(&vs->dev.mutex); | 859 | mutex_unlock(&vs->dev.mutex); |
860 | kfree(vs_tpg); | ||
815 | return -EEXIST; | 861 | return -EEXIST; |
816 | } | 862 | } |
817 | tv_tpg->tv_tpg_vhost_count++; | 863 | tv_tpg->tv_tpg_vhost_count++; |
818 | vs->vs_tpg[tv_tpg->tport_tpgt] = tv_tpg; | 864 | vs_tpg[tv_tpg->tport_tpgt] = tv_tpg; |
819 | smp_mb__after_atomic_inc(); | 865 | smp_mb__after_atomic_inc(); |
820 | match = true; | 866 | match = true; |
821 | } | 867 | } |
@@ -826,12 +872,27 @@ static int vhost_scsi_set_endpoint( | |||
826 | if (match) { | 872 | if (match) { |
827 | memcpy(vs->vs_vhost_wwpn, t->vhost_wwpn, | 873 | memcpy(vs->vs_vhost_wwpn, t->vhost_wwpn, |
828 | sizeof(vs->vs_vhost_wwpn)); | 874 | sizeof(vs->vs_vhost_wwpn)); |
829 | vs->vs_endpoint = true; | 875 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
876 | vq = &vs->vqs[i]; | ||
877 | /* Flushing the vhost_work acts as synchronize_rcu */ | ||
878 | mutex_lock(&vq->mutex); | ||
879 | rcu_assign_pointer(vq->private_data, vs_tpg); | ||
880 | vhost_init_used(vq); | ||
881 | mutex_unlock(&vq->mutex); | ||
882 | } | ||
830 | ret = 0; | 883 | ret = 0; |
831 | } else { | 884 | } else { |
832 | ret = -EEXIST; | 885 | ret = -EEXIST; |
833 | } | 886 | } |
834 | 887 | ||
888 | /* | ||
889 | * Act as synchronize_rcu to make sure access to | ||
890 | * old vs->vs_tpg is finished. | ||
891 | */ | ||
892 | vhost_scsi_flush(vs); | ||
893 | kfree(vs->vs_tpg); | ||
894 | vs->vs_tpg = vs_tpg; | ||
895 | |||
835 | mutex_unlock(&vs->dev.mutex); | 896 | mutex_unlock(&vs->dev.mutex); |
836 | return ret; | 897 | return ret; |
837 | } | 898 | } |
@@ -842,6 +903,8 @@ static int vhost_scsi_clear_endpoint( | |||
842 | { | 903 | { |
843 | struct tcm_vhost_tport *tv_tport; | 904 | struct tcm_vhost_tport *tv_tport; |
844 | struct tcm_vhost_tpg *tv_tpg; | 905 | struct tcm_vhost_tpg *tv_tpg; |
906 | struct vhost_virtqueue *vq; | ||
907 | bool match = false; | ||
845 | int index, ret, i; | 908 | int index, ret, i; |
846 | u8 target; | 909 | u8 target; |
847 | 910 | ||
@@ -850,20 +913,26 @@ static int vhost_scsi_clear_endpoint( | |||
850 | for (index = 0; index < vs->dev.nvqs; ++index) { | 913 | for (index = 0; index < vs->dev.nvqs; ++index) { |
851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { | 914 | if (!vhost_vq_access_ok(&vs->vqs[index])) { |
852 | ret = -EFAULT; | 915 | ret = -EFAULT; |
853 | goto err; | 916 | goto err_dev; |
854 | } | 917 | } |
855 | } | 918 | } |
919 | |||
920 | if (!vs->vs_tpg) { | ||
921 | mutex_unlock(&vs->dev.mutex); | ||
922 | return 0; | ||
923 | } | ||
924 | |||
856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { | 925 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { |
857 | target = i; | 926 | target = i; |
858 | |||
859 | tv_tpg = vs->vs_tpg[target]; | 927 | tv_tpg = vs->vs_tpg[target]; |
860 | if (!tv_tpg) | 928 | if (!tv_tpg) |
861 | continue; | 929 | continue; |
862 | 930 | ||
931 | mutex_lock(&tv_tpg->tv_tpg_mutex); | ||
863 | tv_tport = tv_tpg->tport; | 932 | tv_tport = tv_tpg->tport; |
864 | if (!tv_tport) { | 933 | if (!tv_tport) { |
865 | ret = -ENODEV; | 934 | ret = -ENODEV; |
866 | goto err; | 935 | goto err_tpg; |
867 | } | 936 | } |
868 | 937 | ||
869 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { | 938 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
@@ -872,20 +941,58 @@ static int vhost_scsi_clear_endpoint( | |||
872 | tv_tport->tport_name, tv_tpg->tport_tpgt, | 941 | tv_tport->tport_name, tv_tpg->tport_tpgt, |
873 | t->vhost_wwpn, t->vhost_tpgt); | 942 | t->vhost_wwpn, t->vhost_tpgt); |
874 | ret = -EINVAL; | 943 | ret = -EINVAL; |
875 | goto err; | 944 | goto err_tpg; |
876 | } | 945 | } |
877 | tv_tpg->tv_tpg_vhost_count--; | 946 | tv_tpg->tv_tpg_vhost_count--; |
878 | vs->vs_tpg[target] = NULL; | 947 | vs->vs_tpg[target] = NULL; |
879 | vs->vs_endpoint = false; | 948 | match = true; |
949 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
880 | } | 950 | } |
951 | if (match) { | ||
952 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | ||
953 | vq = &vs->vqs[i]; | ||
954 | /* Flushing the vhost_work acts as synchronize_rcu */ | ||
955 | mutex_lock(&vq->mutex); | ||
956 | rcu_assign_pointer(vq->private_data, NULL); | ||
957 | mutex_unlock(&vq->mutex); | ||
958 | } | ||
959 | } | ||
960 | /* | ||
961 | * Act as synchronize_rcu to make sure access to | ||
962 | * old vs->vs_tpg is finished. | ||
963 | */ | ||
964 | vhost_scsi_flush(vs); | ||
965 | kfree(vs->vs_tpg); | ||
966 | vs->vs_tpg = NULL; | ||
881 | mutex_unlock(&vs->dev.mutex); | 967 | mutex_unlock(&vs->dev.mutex); |
968 | |||
882 | return 0; | 969 | return 0; |
883 | 970 | ||
884 | err: | 971 | err_tpg: |
972 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
973 | err_dev: | ||
885 | mutex_unlock(&vs->dev.mutex); | 974 | mutex_unlock(&vs->dev.mutex); |
886 | return ret; | 975 | return ret; |
887 | } | 976 | } |
888 | 977 | ||
978 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | ||
979 | { | ||
980 | if (features & ~VHOST_SCSI_FEATURES) | ||
981 | return -EOPNOTSUPP; | ||
982 | |||
983 | mutex_lock(&vs->dev.mutex); | ||
984 | if ((features & (1 << VHOST_F_LOG_ALL)) && | ||
985 | !vhost_log_access_ok(&vs->dev)) { | ||
986 | mutex_unlock(&vs->dev.mutex); | ||
987 | return -EFAULT; | ||
988 | } | ||
989 | vs->dev.acked_features = features; | ||
990 | smp_wmb(); | ||
991 | vhost_scsi_flush(vs); | ||
992 | mutex_unlock(&vs->dev.mutex); | ||
993 | return 0; | ||
994 | } | ||
995 | |||
889 | static int vhost_scsi_open(struct inode *inode, struct file *f) | 996 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
890 | { | 997 | { |
891 | struct vhost_scsi *s; | 998 | struct vhost_scsi *s; |
@@ -926,37 +1033,6 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) | |||
926 | return 0; | 1033 | return 0; |
927 | } | 1034 | } |
928 | 1035 | ||
929 | static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index) | ||
930 | { | ||
931 | vhost_poll_flush(&vs->dev.vqs[index].poll); | ||
932 | } | ||
933 | |||
934 | static void vhost_scsi_flush(struct vhost_scsi *vs) | ||
935 | { | ||
936 | int i; | ||
937 | |||
938 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | ||
939 | vhost_scsi_flush_vq(vs, i); | ||
940 | } | ||
941 | |||
942 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | ||
943 | { | ||
944 | if (features & ~VHOST_FEATURES) | ||
945 | return -EOPNOTSUPP; | ||
946 | |||
947 | mutex_lock(&vs->dev.mutex); | ||
948 | if ((features & (1 << VHOST_F_LOG_ALL)) && | ||
949 | !vhost_log_access_ok(&vs->dev)) { | ||
950 | mutex_unlock(&vs->dev.mutex); | ||
951 | return -EFAULT; | ||
952 | } | ||
953 | vs->dev.acked_features = features; | ||
954 | smp_wmb(); | ||
955 | vhost_scsi_flush(vs); | ||
956 | mutex_unlock(&vs->dev.mutex); | ||
957 | return 0; | ||
958 | } | ||
959 | |||
960 | static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, | 1036 | static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, |
961 | unsigned long arg) | 1037 | unsigned long arg) |
962 | { | 1038 | { |
@@ -987,7 +1063,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, | |||
987 | return -EFAULT; | 1063 | return -EFAULT; |
988 | return 0; | 1064 | return 0; |
989 | case VHOST_GET_FEATURES: | 1065 | case VHOST_GET_FEATURES: |
990 | features = VHOST_FEATURES; | 1066 | features = VHOST_SCSI_FEATURES; |
991 | if (copy_to_user(featurep, &features, sizeof features)) | 1067 | if (copy_to_user(featurep, &features, sizeof features)) |
992 | return -EFAULT; | 1068 | return -EFAULT; |
993 | return 0; | 1069 | return 0; |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 12cf5f31ee8f..025428e04c33 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
422 | = var->bits_per_pixel; | 422 | = var->bits_per_pixel; |
423 | break; | 423 | break; |
424 | case 16: | 424 | case 16: |
425 | /* Older SOCs use IBGR:555 rather than BGR:565. */ | ||
426 | if (sinfo->have_intensity_bit) | ||
427 | var->green.length = 5; | ||
428 | else | ||
429 | var->green.length = 6; | ||
430 | |||
425 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { | 431 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
426 | /* RGB:565 mode */ | 432 | /* RGB:5X5 mode */ |
427 | var->red.offset = 11; | 433 | var->red.offset = var->green.length + 5; |
428 | var->blue.offset = 0; | 434 | var->blue.offset = 0; |
429 | } else { | 435 | } else { |
430 | /* BGR:565 mode */ | 436 | /* BGR:5X5 mode */ |
431 | var->red.offset = 0; | 437 | var->red.offset = 0; |
432 | var->blue.offset = 11; | 438 | var->blue.offset = var->green.length + 5; |
433 | } | 439 | } |
434 | var->green.offset = 5; | 440 | var->green.offset = 5; |
435 | var->green.length = 6; | ||
436 | var->red.length = var->blue.length = 5; | 441 | var->red.length = var->blue.length = 5; |
437 | break; | 442 | break; |
438 | case 32: | 443 | case 32: |
@@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, | |||
679 | 684 | ||
680 | case FB_VISUAL_PSEUDOCOLOR: | 685 | case FB_VISUAL_PSEUDOCOLOR: |
681 | if (regno < 256) { | 686 | if (regno < 256) { |
682 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() | 687 | if (sinfo->have_intensity_bit) { |
683 | || cpu_is_at91sam9rl()) { | ||
684 | /* old style I+BGR:555 */ | 688 | /* old style I+BGR:555 */ |
685 | val = ((red >> 11) & 0x001f); | 689 | val = ((red >> 11) & 0x001f); |
686 | val |= ((green >> 6) & 0x03e0); | 690 | val |= ((green >> 6) & 0x03e0); |
@@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
870 | } | 874 | } |
871 | sinfo->info = info; | 875 | sinfo->info = info; |
872 | sinfo->pdev = pdev; | 876 | sinfo->pdev = pdev; |
877 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || | ||
878 | cpu_is_at91sam9rl()) { | ||
879 | sinfo->have_intensity_bit = true; | ||
880 | } | ||
873 | 881 | ||
874 | strcpy(info->fix.id, sinfo->pdev->name); | 882 | strcpy(info->fix.id, sinfo->pdev->name); |
875 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; | 883 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; |
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index 3f2519d30715..e06cd5d90c97 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | #include <linux/io.h> | ||
26 | 27 | ||
27 | #include <linux/platform_data/video-ep93xx.h> | 28 | #include <linux/platform_data/video-ep93xx.h> |
28 | 29 | ||
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 7c254084b6a0..86291dcd964a 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1373,15 +1373,12 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
1373 | { | 1373 | { |
1374 | struct fb_info *info = file_fb_info(file); | 1374 | struct fb_info *info = file_fb_info(file); |
1375 | struct fb_ops *fb; | 1375 | struct fb_ops *fb; |
1376 | unsigned long off; | 1376 | unsigned long mmio_pgoff; |
1377 | unsigned long start; | 1377 | unsigned long start; |
1378 | u32 len; | 1378 | u32 len; |
1379 | 1379 | ||
1380 | if (!info) | 1380 | if (!info) |
1381 | return -ENODEV; | 1381 | return -ENODEV; |
1382 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) | ||
1383 | return -EINVAL; | ||
1384 | off = vma->vm_pgoff << PAGE_SHIFT; | ||
1385 | fb = info->fbops; | 1382 | fb = info->fbops; |
1386 | if (!fb) | 1383 | if (!fb) |
1387 | return -ENODEV; | 1384 | return -ENODEV; |
@@ -1393,32 +1390,24 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
1393 | return res; | 1390 | return res; |
1394 | } | 1391 | } |
1395 | 1392 | ||
1396 | /* frame buffer memory */ | 1393 | /* |
1394 | * Ugh. This can be either the frame buffer mapping, or | ||
1395 | * if pgoff points past it, the mmio mapping. | ||
1396 | */ | ||
1397 | start = info->fix.smem_start; | 1397 | start = info->fix.smem_start; |
1398 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); | 1398 | len = info->fix.smem_len; |
1399 | if (off >= len) { | 1399 | mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; |
1400 | /* memory mapped io */ | 1400 | if (vma->vm_pgoff >= mmio_pgoff) { |
1401 | off -= len; | 1401 | vma->vm_pgoff -= mmio_pgoff; |
1402 | if (info->var.accel_flags) { | ||
1403 | mutex_unlock(&info->mm_lock); | ||
1404 | return -EINVAL; | ||
1405 | } | ||
1406 | start = info->fix.mmio_start; | 1402 | start = info->fix.mmio_start; |
1407 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); | 1403 | len = info->fix.mmio_len; |
1408 | } | 1404 | } |
1409 | mutex_unlock(&info->mm_lock); | 1405 | mutex_unlock(&info->mm_lock); |
1410 | start &= PAGE_MASK; | 1406 | |
1411 | if ((vma->vm_end - vma->vm_start + off) > len) | ||
1412 | return -EINVAL; | ||
1413 | off += start; | ||
1414 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
1415 | /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by io_remap_pfn_range()*/ | ||
1416 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | 1407 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
1417 | fb_pgprotect(file, vma, off); | 1408 | fb_pgprotect(file, vma, start); |
1418 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 1409 | |
1419 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) | 1410 | return vm_iomap_memory(vma, start, len); |
1420 | return -EAGAIN; | ||
1421 | return 0; | ||
1422 | } | 1411 | } |
1423 | 1412 | ||
1424 | static int | 1413 | static int |
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index 94ad0f71383c..7f6709991a5c 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c | |||
@@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm, | |||
1400 | fbmode->vmode = 0; | 1400 | fbmode->vmode = 0; |
1401 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) | 1401 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) |
1402 | fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; | 1402 | fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; |
1403 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) | 1403 | if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH) |
1404 | fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; | 1404 | fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; |
1405 | if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) | 1405 | if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) |
1406 | fbmode->vmode |= FB_VMODE_INTERLACED; | 1406 | fbmode->vmode |= FB_VMODE_INTERLACED; |
diff --git a/drivers/video/mmp/core.c b/drivers/video/mmp/core.c index 9ed83419038b..84de2632857a 100644 --- a/drivers/video/mmp/core.c +++ b/drivers/video/mmp/core.c | |||
@@ -252,7 +252,5 @@ void mmp_unregister_path(struct mmp_path *path) | |||
252 | 252 | ||
253 | kfree(path); | 253 | kfree(path); |
254 | mutex_unlock(&disp_lock); | 254 | mutex_unlock(&disp_lock); |
255 | |||
256 | dev_info(path->dev, "de-register %s\n", path->name); | ||
257 | } | 255 | } |
258 | EXPORT_SYMBOL_GPL(mmp_unregister_path); | 256 | EXPORT_SYMBOL_GPL(mmp_unregister_path); |
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 755556ca5b2d..45169cbaba6e 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c | |||
@@ -169,6 +169,7 @@ struct mxsfb_info { | |||
169 | unsigned dotclk_delay; | 169 | unsigned dotclk_delay; |
170 | const struct mxsfb_devdata *devdata; | 170 | const struct mxsfb_devdata *devdata; |
171 | int mapped; | 171 | int mapped; |
172 | u32 sync; | ||
172 | }; | 173 | }; |
173 | 174 | ||
174 | #define mxsfb_is_v3(host) (host->devdata->ipversion == 3) | 175 | #define mxsfb_is_v3(host) (host->devdata->ipversion == 3) |
@@ -456,9 +457,9 @@ static int mxsfb_set_par(struct fb_info *fb_info) | |||
456 | vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH; | 457 | vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH; |
457 | if (fb_info->var.sync & FB_SYNC_VERT_HIGH_ACT) | 458 | if (fb_info->var.sync & FB_SYNC_VERT_HIGH_ACT) |
458 | vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH; | 459 | vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH; |
459 | if (fb_info->var.sync & FB_SYNC_DATA_ENABLE_HIGH_ACT) | 460 | if (host->sync & MXSFB_SYNC_DATA_ENABLE_HIGH_ACT) |
460 | vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH; | 461 | vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH; |
461 | if (fb_info->var.sync & FB_SYNC_DOTCLK_FAILING_ACT) | 462 | if (host->sync & MXSFB_SYNC_DOTCLK_FAILING_ACT) |
462 | vdctrl0 |= VDCTRL0_DOTCLK_ACT_FAILING; | 463 | vdctrl0 |= VDCTRL0_DOTCLK_ACT_FAILING; |
463 | 464 | ||
464 | writel(vdctrl0, host->base + LCDC_VDCTRL0); | 465 | writel(vdctrl0, host->base + LCDC_VDCTRL0); |
@@ -861,6 +862,8 @@ static int mxsfb_probe(struct platform_device *pdev) | |||
861 | 862 | ||
862 | INIT_LIST_HEAD(&fb_info->modelist); | 863 | INIT_LIST_HEAD(&fb_info->modelist); |
863 | 864 | ||
865 | host->sync = pdata->sync; | ||
866 | |||
864 | ret = mxsfb_init_fbinfo(host); | 867 | ret = mxsfb_init_fbinfo(host); |
865 | if (ret != 0) | 868 | if (ret != 0) |
866 | goto error_init_fb; | 869 | goto error_init_fb; |
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c index ed4cad87fbcd..4a5f2cd3d3bf 100644 --- a/drivers/video/omap/lcd_ams_delta.c +++ b/drivers/video/omap/lcd_ams_delta.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/lcd.h> | 27 | #include <linux/lcd.h> |
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | ||
30 | #include <mach/board-ams-delta.h> | 31 | #include <mach/board-ams-delta.h> |
31 | 32 | ||
32 | #include "omapfb.h" | 33 | #include "omapfb.h" |
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c index 3aa62da89195..7fbe04bce0ed 100644 --- a/drivers/video/omap/lcd_osk.c +++ b/drivers/video/omap/lcd_osk.c | |||
@@ -24,7 +24,10 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | 25 | ||
26 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
27 | |||
28 | #include <mach/hardware.h> | ||
27 | #include <mach/mux.h> | 29 | #include <mach/mux.h> |
30 | |||
28 | #include "omapfb.h" | 31 | #include "omapfb.h" |
29 | 32 | ||
30 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) | 33 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) |
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index e31f5b33b501..d40612c31a98 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | #include <linux/omap-dma.h> | 33 | #include <linux/omap-dma.h> |
34 | 34 | ||
35 | #include <mach/hardware.h> | ||
36 | |||
35 | #include "omapfb.h" | 37 | #include "omapfb.h" |
36 | #include "lcdc.h" | 38 | #include "lcdc.h" |
37 | 39 | ||
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c index 6b6643911d29..048c98381ef6 100644 --- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c +++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c | |||
@@ -63,6 +63,9 @@ struct tpo_td043_device { | |||
63 | u32 power_on_resume:1; | 63 | u32 power_on_resume:1; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | /* used to pass spi_device from SPI to DSS portion of the driver */ | ||
67 | static struct tpo_td043_device *g_tpo_td043; | ||
68 | |||
66 | static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) | 69 | static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) |
67 | { | 70 | { |
68 | struct spi_message m; | 71 | struct spi_message m; |
@@ -403,7 +406,7 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev) | |||
403 | 406 | ||
404 | static int tpo_td043_probe(struct omap_dss_device *dssdev) | 407 | static int tpo_td043_probe(struct omap_dss_device *dssdev) |
405 | { | 408 | { |
406 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | 409 | struct tpo_td043_device *tpo_td043 = g_tpo_td043; |
407 | int nreset_gpio = dssdev->reset_gpio; | 410 | int nreset_gpio = dssdev->reset_gpio; |
408 | int ret = 0; | 411 | int ret = 0; |
409 | 412 | ||
@@ -440,6 +443,8 @@ static int tpo_td043_probe(struct omap_dss_device *dssdev) | |||
440 | if (ret) | 443 | if (ret) |
441 | dev_warn(&dssdev->dev, "failed to create sysfs files\n"); | 444 | dev_warn(&dssdev->dev, "failed to create sysfs files\n"); |
442 | 445 | ||
446 | dev_set_drvdata(&dssdev->dev, tpo_td043); | ||
447 | |||
443 | return 0; | 448 | return 0; |
444 | 449 | ||
445 | fail_gpio_req: | 450 | fail_gpio_req: |
@@ -505,6 +510,9 @@ static int tpo_td043_spi_probe(struct spi_device *spi) | |||
505 | return -ENODEV; | 510 | return -ENODEV; |
506 | } | 511 | } |
507 | 512 | ||
513 | if (g_tpo_td043 != NULL) | ||
514 | return -EBUSY; | ||
515 | |||
508 | spi->bits_per_word = 16; | 516 | spi->bits_per_word = 16; |
509 | spi->mode = SPI_MODE_0; | 517 | spi->mode = SPI_MODE_0; |
510 | 518 | ||
@@ -521,7 +529,7 @@ static int tpo_td043_spi_probe(struct spi_device *spi) | |||
521 | tpo_td043->spi = spi; | 529 | tpo_td043->spi = spi; |
522 | tpo_td043->nreset_gpio = dssdev->reset_gpio; | 530 | tpo_td043->nreset_gpio = dssdev->reset_gpio; |
523 | dev_set_drvdata(&spi->dev, tpo_td043); | 531 | dev_set_drvdata(&spi->dev, tpo_td043); |
524 | dev_set_drvdata(&dssdev->dev, tpo_td043); | 532 | g_tpo_td043 = tpo_td043; |
525 | 533 | ||
526 | omap_dss_register_driver(&tpo_td043_driver); | 534 | omap_dss_register_driver(&tpo_td043_driver); |
527 | 535 | ||
@@ -534,6 +542,7 @@ static int tpo_td043_spi_remove(struct spi_device *spi) | |||
534 | 542 | ||
535 | omap_dss_unregister_driver(&tpo_td043_driver); | 543 | omap_dss_unregister_driver(&tpo_td043_driver); |
536 | kfree(tpo_td043); | 544 | kfree(tpo_td043); |
545 | g_tpo_td043 = NULL; | ||
537 | 546 | ||
538 | return 0; | 547 | return 0; |
539 | } | 548 | } |
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index d7d66ef5cb58..7f791aeda4d2 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c | |||
@@ -202,12 +202,10 @@ static const enum omap_dss_output_id omap3630_dss_supported_outputs[] = { | |||
202 | 202 | ||
203 | static const enum omap_dss_output_id omap4_dss_supported_outputs[] = { | 203 | static const enum omap_dss_output_id omap4_dss_supported_outputs[] = { |
204 | /* OMAP_DSS_CHANNEL_LCD */ | 204 | /* OMAP_DSS_CHANNEL_LCD */ |
205 | OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI | | 205 | OMAP_DSS_OUTPUT_DBI | OMAP_DSS_OUTPUT_DSI1, |
206 | OMAP_DSS_OUTPUT_DSI1, | ||
207 | 206 | ||
208 | /* OMAP_DSS_CHANNEL_DIGIT */ | 207 | /* OMAP_DSS_CHANNEL_DIGIT */ |
209 | OMAP_DSS_OUTPUT_VENC | OMAP_DSS_OUTPUT_HDMI | | 208 | OMAP_DSS_OUTPUT_VENC | OMAP_DSS_OUTPUT_HDMI, |
210 | OMAP_DSS_OUTPUT_DPI, | ||
211 | 209 | ||
212 | /* OMAP_DSS_CHANNEL_LCD2 */ | 210 | /* OMAP_DSS_CHANNEL_LCD2 */ |
213 | OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI | | 211 | OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI | |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 63203acef812..0264704a52be 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -858,6 +858,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) | |||
858 | tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16) | 858 | tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16) |
859 | | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7); | 859 | | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7); |
860 | lcdc_write_chan(ch, LDHAJR, tmp); | 860 | lcdc_write_chan(ch, LDHAJR, tmp); |
861 | lcdc_write_chan_mirror(ch, LDHAJR, tmp); | ||
861 | } | 862 | } |
862 | 863 | ||
863 | static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) | 864 | static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index b75db0186488..d4284458377e 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -1973,7 +1973,8 @@ static int uvesafb_init(void) | |||
1973 | err = -ENOMEM; | 1973 | err = -ENOMEM; |
1974 | 1974 | ||
1975 | if (err) { | 1975 | if (err) { |
1976 | platform_device_put(uvesafb_device); | 1976 | if (uvesafb_device) |
1977 | platform_device_put(uvesafb_device); | ||
1977 | platform_driver_unregister(&uvesafb_driver); | 1978 | platform_driver_unregister(&uvesafb_driver); |
1978 | cn_del_callback(&uvesafb_cn_id); | 1979 | cn_del_callback(&uvesafb_cn_id); |
1979 | return err; | 1980 | return err; |
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index d39dfa4cc235..46d97014342e 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c | |||
@@ -47,11 +47,13 @@ static u8 w1_gpio_read_bit(void *data) | |||
47 | return gpio_get_value(pdata->pin) ? 1 : 0; | 47 | return gpio_get_value(pdata->pin) ? 1 : 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | #if defined(CONFIG_OF) | ||
50 | static struct of_device_id w1_gpio_dt_ids[] = { | 51 | static struct of_device_id w1_gpio_dt_ids[] = { |
51 | { .compatible = "w1-gpio" }, | 52 | { .compatible = "w1-gpio" }, |
52 | {} | 53 | {} |
53 | }; | 54 | }; |
54 | MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); | 55 | MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); |
56 | #endif | ||
55 | 57 | ||
56 | static int w1_gpio_probe_dt(struct platform_device *pdev) | 58 | static int w1_gpio_probe_dt(struct platform_device *pdev) |
57 | { | 59 | { |
@@ -158,7 +160,7 @@ static int w1_gpio_probe(struct platform_device *pdev) | |||
158 | return err; | 160 | return err; |
159 | } | 161 | } |
160 | 162 | ||
161 | static int __exit w1_gpio_remove(struct platform_device *pdev) | 163 | static int w1_gpio_remove(struct platform_device *pdev) |
162 | { | 164 | { |
163 | struct w1_bus_master *master = platform_get_drvdata(pdev); | 165 | struct w1_bus_master *master = platform_get_drvdata(pdev); |
164 | struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; | 166 | struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; |
@@ -210,7 +212,7 @@ static struct platform_driver w1_gpio_driver = { | |||
210 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), | 212 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), |
211 | }, | 213 | }, |
212 | .probe = w1_gpio_probe, | 214 | .probe = w1_gpio_probe, |
213 | .remove = __exit_p(w1_gpio_remove), | 215 | .remove = w1_gpio_remove, |
214 | .suspend = w1_gpio_suspend, | 216 | .suspend = w1_gpio_suspend, |
215 | .resume = w1_gpio_resume, | 217 | .resume = w1_gpio_resume, |
216 | }; | 218 | }; |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 7994d933f040..7ce277d2bb67 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -924,7 +924,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb | |||
924 | tmp64 = (triplet_ret >> 2); | 924 | tmp64 = (triplet_ret >> 2); |
925 | rn |= (tmp64 << i); | 925 | rn |= (tmp64 << i); |
926 | 926 | ||
927 | if (kthread_should_stop()) { | 927 | /* ensure we're called from kthread and not by netlink callback */ |
928 | if (!dev->priv && kthread_should_stop()) { | ||
928 | mutex_unlock(&dev->bus_mutex); | 929 | mutex_unlock(&dev->bus_mutex); |
929 | dev_dbg(&dev->dev, "Abort w1_search\n"); | 930 | dev_dbg(&dev->dev, "Abort w1_search\n"); |
930 | return; | 931 | return; |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 9fcc70c11cea..e89fc3133972 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -117,7 +117,7 @@ config ARM_SP805_WATCHDOG | |||
117 | 117 | ||
118 | config AT91RM9200_WATCHDOG | 118 | config AT91RM9200_WATCHDOG |
119 | tristate "AT91RM9200 watchdog" | 119 | tristate "AT91RM9200 watchdog" |
120 | depends on ARCH_AT91 | 120 | depends on ARCH_AT91RM9200 |
121 | help | 121 | help |
122 | Watchdog timer embedded into AT91RM9200 chips. This will reboot your | 122 | Watchdog timer embedded into AT91RM9200 chips. This will reboot your |
123 | system when the timeout is reached. | 123 | system when the timeout is reached. |
diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index e3b8f757d2d3..0e9d8c479c35 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c | |||
@@ -40,13 +40,12 @@ | |||
40 | #include "sp5100_tco.h" | 40 | #include "sp5100_tco.h" |
41 | 41 | ||
42 | /* Module and version information */ | 42 | /* Module and version information */ |
43 | #define TCO_VERSION "0.03" | 43 | #define TCO_VERSION "0.05" |
44 | #define TCO_MODULE_NAME "SP5100 TCO timer" | 44 | #define TCO_MODULE_NAME "SP5100 TCO timer" |
45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
46 | 46 | ||
47 | /* internal variables */ | 47 | /* internal variables */ |
48 | static u32 tcobase_phys; | 48 | static u32 tcobase_phys; |
49 | static u32 resbase_phys; | ||
50 | static u32 tco_wdt_fired; | 49 | static u32 tco_wdt_fired; |
51 | static void __iomem *tcobase; | 50 | static void __iomem *tcobase; |
52 | static unsigned int pm_iobase; | 51 | static unsigned int pm_iobase; |
@@ -54,10 +53,6 @@ static DEFINE_SPINLOCK(tco_lock); /* Guards the hardware */ | |||
54 | static unsigned long timer_alive; | 53 | static unsigned long timer_alive; |
55 | static char tco_expect_close; | 54 | static char tco_expect_close; |
56 | static struct pci_dev *sp5100_tco_pci; | 55 | static struct pci_dev *sp5100_tco_pci; |
57 | static struct resource wdt_res = { | ||
58 | .name = "Watchdog Timer", | ||
59 | .flags = IORESOURCE_MEM, | ||
60 | }; | ||
61 | 56 | ||
62 | /* the watchdog platform device */ | 57 | /* the watchdog platform device */ |
63 | static struct platform_device *sp5100_tco_platform_device; | 58 | static struct platform_device *sp5100_tco_platform_device; |
@@ -75,12 +70,6 @@ module_param(nowayout, bool, 0); | |||
75 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." | 70 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." |
76 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 71 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
77 | 72 | ||
78 | static unsigned int force_addr; | ||
79 | module_param(force_addr, uint, 0); | ||
80 | MODULE_PARM_DESC(force_addr, "Force the use of specified MMIO address." | ||
81 | " ONLY USE THIS PARAMETER IF YOU REALLY KNOW" | ||
82 | " WHAT YOU ARE DOING (default=none)"); | ||
83 | |||
84 | /* | 73 | /* |
85 | * Some TCO specific functions | 74 | * Some TCO specific functions |
86 | */ | 75 | */ |
@@ -176,39 +165,6 @@ static void tco_timer_enable(void) | |||
176 | } | 165 | } |
177 | } | 166 | } |
178 | 167 | ||
179 | static void tco_timer_disable(void) | ||
180 | { | ||
181 | int val; | ||
182 | |||
183 | if (sp5100_tco_pci->revision >= 0x40) { | ||
184 | /* For SB800 or later */ | ||
185 | /* Enable watchdog decode bit and Disable watchdog timer */ | ||
186 | outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG); | ||
187 | val = inb(SB800_IO_PM_DATA_REG); | ||
188 | val |= SB800_PCI_WATCHDOG_DECODE_EN; | ||
189 | val |= SB800_PM_WATCHDOG_DISABLE; | ||
190 | outb(val, SB800_IO_PM_DATA_REG); | ||
191 | } else { | ||
192 | /* For SP5100 or SB7x0 */ | ||
193 | /* Enable watchdog decode bit */ | ||
194 | pci_read_config_dword(sp5100_tco_pci, | ||
195 | SP5100_PCI_WATCHDOG_MISC_REG, | ||
196 | &val); | ||
197 | |||
198 | val |= SP5100_PCI_WATCHDOG_DECODE_EN; | ||
199 | |||
200 | pci_write_config_dword(sp5100_tco_pci, | ||
201 | SP5100_PCI_WATCHDOG_MISC_REG, | ||
202 | val); | ||
203 | |||
204 | /* Disable Watchdog timer */ | ||
205 | outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG); | ||
206 | val = inb(SP5100_IO_PM_DATA_REG); | ||
207 | val |= SP5100_PM_WATCHDOG_DISABLE; | ||
208 | outb(val, SP5100_IO_PM_DATA_REG); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | /* | 168 | /* |
213 | * /dev/watchdog handling | 169 | * /dev/watchdog handling |
214 | */ | 170 | */ |
@@ -361,7 +317,7 @@ static unsigned char sp5100_tco_setupdevice(void) | |||
361 | { | 317 | { |
362 | struct pci_dev *dev = NULL; | 318 | struct pci_dev *dev = NULL; |
363 | const char *dev_name = NULL; | 319 | const char *dev_name = NULL; |
364 | u32 val, tmp_val; | 320 | u32 val; |
365 | u32 index_reg, data_reg, base_addr; | 321 | u32 index_reg, data_reg, base_addr; |
366 | 322 | ||
367 | /* Match the PCI device */ | 323 | /* Match the PCI device */ |
@@ -459,63 +415,8 @@ static unsigned char sp5100_tco_setupdevice(void) | |||
459 | } else | 415 | } else |
460 | pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val); | 416 | pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val); |
461 | 417 | ||
462 | /* | 418 | pr_notice("failed to find MMIO address, giving up.\n"); |
463 | * Lastly re-programming the watchdog timer MMIO address, | 419 | goto unreg_region; |
464 | * This method is a last resort... | ||
465 | * | ||
466 | * Before re-programming, to ensure that the watchdog timer | ||
467 | * is disabled, disable the watchdog timer. | ||
468 | */ | ||
469 | tco_timer_disable(); | ||
470 | |||
471 | if (force_addr) { | ||
472 | /* | ||
473 | * Force the use of watchdog timer MMIO address, and aligned to | ||
474 | * 8byte boundary. | ||
475 | */ | ||
476 | force_addr &= ~0x7; | ||
477 | val = force_addr; | ||
478 | |||
479 | pr_info("Force the use of 0x%04x as MMIO address\n", val); | ||
480 | } else { | ||
481 | /* | ||
482 | * Get empty slot into the resource tree for watchdog timer. | ||
483 | */ | ||
484 | if (allocate_resource(&iomem_resource, | ||
485 | &wdt_res, | ||
486 | SP5100_WDT_MEM_MAP_SIZE, | ||
487 | 0xf0000000, | ||
488 | 0xfffffff8, | ||
489 | 0x8, | ||
490 | NULL, | ||
491 | NULL)) { | ||
492 | pr_err("MMIO allocation failed\n"); | ||
493 | goto unreg_region; | ||
494 | } | ||
495 | |||
496 | val = resbase_phys = wdt_res.start; | ||
497 | pr_debug("Got 0x%04x from resource tree\n", val); | ||
498 | } | ||
499 | |||
500 | /* Restore to the low three bits */ | ||
501 | outb(base_addr+0, index_reg); | ||
502 | tmp_val = val | (inb(data_reg) & 0x7); | ||
503 | |||
504 | /* Re-programming the watchdog timer base address */ | ||
505 | outb(base_addr+0, index_reg); | ||
506 | outb((tmp_val >> 0) & 0xff, data_reg); | ||
507 | outb(base_addr+1, index_reg); | ||
508 | outb((tmp_val >> 8) & 0xff, data_reg); | ||
509 | outb(base_addr+2, index_reg); | ||
510 | outb((tmp_val >> 16) & 0xff, data_reg); | ||
511 | outb(base_addr+3, index_reg); | ||
512 | outb((tmp_val >> 24) & 0xff, data_reg); | ||
513 | |||
514 | if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE, | ||
515 | dev_name)) { | ||
516 | pr_err("MMIO address 0x%04x already in use\n", val); | ||
517 | goto unreg_resource; | ||
518 | } | ||
519 | 420 | ||
520 | setup_wdt: | 421 | setup_wdt: |
521 | tcobase_phys = val; | 422 | tcobase_phys = val; |
@@ -555,9 +456,6 @@ setup_wdt: | |||
555 | 456 | ||
556 | unreg_mem_region: | 457 | unreg_mem_region: |
557 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 458 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
558 | unreg_resource: | ||
559 | if (resbase_phys) | ||
560 | release_resource(&wdt_res); | ||
561 | unreg_region: | 459 | unreg_region: |
562 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 460 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
563 | exit: | 461 | exit: |
@@ -567,7 +465,6 @@ exit: | |||
567 | static int sp5100_tco_init(struct platform_device *dev) | 465 | static int sp5100_tco_init(struct platform_device *dev) |
568 | { | 466 | { |
569 | int ret; | 467 | int ret; |
570 | char addr_str[16]; | ||
571 | 468 | ||
572 | /* | 469 | /* |
573 | * Check whether or not the hardware watchdog is there. If found, then | 470 | * Check whether or not the hardware watchdog is there. If found, then |
@@ -599,23 +496,14 @@ static int sp5100_tco_init(struct platform_device *dev) | |||
599 | clear_bit(0, &timer_alive); | 496 | clear_bit(0, &timer_alive); |
600 | 497 | ||
601 | /* Show module parameters */ | 498 | /* Show module parameters */ |
602 | if (force_addr == tcobase_phys) | 499 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", |
603 | /* The force_addr is vaild */ | 500 | tcobase, heartbeat, nowayout); |
604 | sprintf(addr_str, "0x%04x", force_addr); | ||
605 | else | ||
606 | strcpy(addr_str, "none"); | ||
607 | |||
608 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d, " | ||
609 | "force_addr=%s)\n", | ||
610 | tcobase, heartbeat, nowayout, addr_str); | ||
611 | 501 | ||
612 | return 0; | 502 | return 0; |
613 | 503 | ||
614 | exit: | 504 | exit: |
615 | iounmap(tcobase); | 505 | iounmap(tcobase); |
616 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 506 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
617 | if (resbase_phys) | ||
618 | release_resource(&wdt_res); | ||
619 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 507 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
620 | return ret; | 508 | return ret; |
621 | } | 509 | } |
@@ -630,8 +518,6 @@ static void sp5100_tco_cleanup(void) | |||
630 | misc_deregister(&sp5100_tco_miscdev); | 518 | misc_deregister(&sp5100_tco_miscdev); |
631 | iounmap(tcobase); | 519 | iounmap(tcobase); |
632 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 520 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
633 | if (resbase_phys) | ||
634 | release_resource(&wdt_res); | ||
635 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 521 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
636 | } | 522 | } |
637 | 523 | ||
diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h index 71594a0c14b7..2b28c00da0df 100644 --- a/drivers/watchdog/sp5100_tco.h +++ b/drivers/watchdog/sp5100_tco.h | |||
@@ -57,7 +57,7 @@ | |||
57 | #define SB800_PM_WATCHDOG_DISABLE (1 << 2) | 57 | #define SB800_PM_WATCHDOG_DISABLE (1 << 2) |
58 | #define SB800_PM_WATCHDOG_SECOND_RES (3 << 0) | 58 | #define SB800_PM_WATCHDOG_SECOND_RES (3 << 0) |
59 | #define SB800_ACPI_MMIO_DECODE_EN (1 << 0) | 59 | #define SB800_ACPI_MMIO_DECODE_EN (1 << 0) |
60 | #define SB800_ACPI_MMIO_SEL (1 << 2) | 60 | #define SB800_ACPI_MMIO_SEL (1 << 1) |
61 | 61 | ||
62 | 62 | ||
63 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 | 63 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 5a32232cf7c1..67af155cf602 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -182,7 +182,7 @@ config XEN_PRIVCMD | |||
182 | 182 | ||
183 | config XEN_STUB | 183 | config XEN_STUB |
184 | bool "Xen stub drivers" | 184 | bool "Xen stub drivers" |
185 | depends on XEN && X86_64 | 185 | depends on XEN && X86_64 && BROKEN |
186 | default n | 186 | default n |
187 | help | 187 | help |
188 | Allow kernel to install stub drivers, to reserve space for Xen drivers, | 188 | Allow kernel to install stub drivers, to reserve space for Xen drivers, |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index d17aa41a9041..2647ad8e1f19 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -403,11 +403,23 @@ static void unmask_evtchn(int port) | |||
403 | 403 | ||
404 | if (unlikely((cpu != cpu_from_evtchn(port)))) | 404 | if (unlikely((cpu != cpu_from_evtchn(port)))) |
405 | do_hypercall = 1; | 405 | do_hypercall = 1; |
406 | else | 406 | else { |
407 | /* | ||
408 | * Need to clear the mask before checking pending to | ||
409 | * avoid a race with an event becoming pending. | ||
410 | * | ||
411 | * EVTCHNOP_unmask will only trigger an upcall if the | ||
412 | * mask bit was set, so if a hypercall is needed | ||
413 | * remask the event. | ||
414 | */ | ||
415 | sync_clear_bit(port, BM(&s->evtchn_mask[0])); | ||
407 | evtchn_pending = sync_test_bit(port, BM(&s->evtchn_pending[0])); | 416 | evtchn_pending = sync_test_bit(port, BM(&s->evtchn_pending[0])); |
408 | 417 | ||
409 | if (unlikely(evtchn_pending && xen_hvm_domain())) | 418 | if (unlikely(evtchn_pending && xen_hvm_domain())) { |
410 | do_hypercall = 1; | 419 | sync_set_bit(port, BM(&s->evtchn_mask[0])); |
420 | do_hypercall = 1; | ||
421 | } | ||
422 | } | ||
411 | 423 | ||
412 | /* Slow path (hypercall) if this is a non-local port or if this is | 424 | /* Slow path (hypercall) if this is a non-local port or if this is |
413 | * an hvm domain and an event is pending (hvm domains don't have | 425 | * an hvm domain and an event is pending (hvm domains don't have |
@@ -418,8 +430,6 @@ static void unmask_evtchn(int port) | |||
418 | } else { | 430 | } else { |
419 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); | 431 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); |
420 | 432 | ||
421 | sync_clear_bit(port, BM(&s->evtchn_mask[0])); | ||
422 | |||
423 | /* | 433 | /* |
424 | * The following is basically the equivalent of | 434 | * The following is basically the equivalent of |
425 | * 'hw_resend_irq'. Just like a real IO-APIC we 'lose | 435 | * 'hw_resend_irq'. Just like a real IO-APIC we 'lose |
@@ -1306,7 +1316,7 @@ static void __xen_evtchn_do_upcall(void) | |||
1306 | { | 1316 | { |
1307 | int start_word_idx, start_bit_idx; | 1317 | int start_word_idx, start_bit_idx; |
1308 | int word_idx, bit_idx; | 1318 | int word_idx, bit_idx; |
1309 | int i; | 1319 | int i, irq; |
1310 | int cpu = get_cpu(); | 1320 | int cpu = get_cpu(); |
1311 | struct shared_info *s = HYPERVISOR_shared_info; | 1321 | struct shared_info *s = HYPERVISOR_shared_info; |
1312 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); | 1322 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); |
@@ -1314,6 +1324,8 @@ static void __xen_evtchn_do_upcall(void) | |||
1314 | 1324 | ||
1315 | do { | 1325 | do { |
1316 | xen_ulong_t pending_words; | 1326 | xen_ulong_t pending_words; |
1327 | xen_ulong_t pending_bits; | ||
1328 | struct irq_desc *desc; | ||
1317 | 1329 | ||
1318 | vcpu_info->evtchn_upcall_pending = 0; | 1330 | vcpu_info->evtchn_upcall_pending = 0; |
1319 | 1331 | ||
@@ -1325,6 +1337,17 @@ static void __xen_evtchn_do_upcall(void) | |||
1325 | * selector flag. xchg_xen_ulong must contain an | 1337 | * selector flag. xchg_xen_ulong must contain an |
1326 | * appropriate barrier. | 1338 | * appropriate barrier. |
1327 | */ | 1339 | */ |
1340 | if ((irq = per_cpu(virq_to_irq, cpu)[VIRQ_TIMER]) != -1) { | ||
1341 | int evtchn = evtchn_from_irq(irq); | ||
1342 | word_idx = evtchn / BITS_PER_LONG; | ||
1343 | pending_bits = evtchn % BITS_PER_LONG; | ||
1344 | if (active_evtchns(cpu, s, word_idx) & (1ULL << pending_bits)) { | ||
1345 | desc = irq_to_desc(irq); | ||
1346 | if (desc) | ||
1347 | generic_handle_irq_desc(irq, desc); | ||
1348 | } | ||
1349 | } | ||
1350 | |||
1328 | pending_words = xchg_xen_ulong(&vcpu_info->evtchn_pending_sel, 0); | 1351 | pending_words = xchg_xen_ulong(&vcpu_info->evtchn_pending_sel, 0); |
1329 | 1352 | ||
1330 | start_word_idx = __this_cpu_read(current_word_idx); | 1353 | start_word_idx = __this_cpu_read(current_word_idx); |
@@ -1333,7 +1356,6 @@ static void __xen_evtchn_do_upcall(void) | |||
1333 | word_idx = start_word_idx; | 1356 | word_idx = start_word_idx; |
1334 | 1357 | ||
1335 | for (i = 0; pending_words != 0; i++) { | 1358 | for (i = 0; pending_words != 0; i++) { |
1336 | xen_ulong_t pending_bits; | ||
1337 | xen_ulong_t words; | 1359 | xen_ulong_t words; |
1338 | 1360 | ||
1339 | words = MASK_LSBS(pending_words, word_idx); | 1361 | words = MASK_LSBS(pending_words, word_idx); |
@@ -1362,8 +1384,7 @@ static void __xen_evtchn_do_upcall(void) | |||
1362 | 1384 | ||
1363 | do { | 1385 | do { |
1364 | xen_ulong_t bits; | 1386 | xen_ulong_t bits; |
1365 | int port, irq; | 1387 | int port; |
1366 | struct irq_desc *desc; | ||
1367 | 1388 | ||
1368 | bits = MASK_LSBS(pending_bits, bit_idx); | 1389 | bits = MASK_LSBS(pending_bits, bit_idx); |
1369 | 1390 | ||
diff --git a/drivers/xen/fallback.c b/drivers/xen/fallback.c index 0ef7c4d40f86..b04fb64c5a91 100644 --- a/drivers/xen/fallback.c +++ b/drivers/xen/fallback.c | |||
@@ -44,7 +44,7 @@ int xen_event_channel_op_compat(int cmd, void *arg) | |||
44 | } | 44 | } |
45 | EXPORT_SYMBOL_GPL(xen_event_channel_op_compat); | 45 | EXPORT_SYMBOL_GPL(xen_event_channel_op_compat); |
46 | 46 | ||
47 | int HYPERVISOR_physdev_op_compat(int cmd, void *arg) | 47 | int xen_physdev_op_compat(int cmd, void *arg) |
48 | { | 48 | { |
49 | struct physdev_op op; | 49 | struct physdev_op op; |
50 | int rc; | 50 | int rc; |
@@ -78,3 +78,4 @@ int HYPERVISOR_physdev_op_compat(int cmd, void *arg) | |||
78 | 78 | ||
79 | return rc; | 79 | return rc; |
80 | } | 80 | } |
81 | EXPORT_SYMBOL_GPL(xen_physdev_op_compat); | ||
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 316df65163cf..90e34ac7e522 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
@@ -500,16 +500,19 @@ static int __init xen_acpi_processor_init(void) | |||
500 | (void)acpi_processor_preregister_performance(acpi_perf_data); | 500 | (void)acpi_processor_preregister_performance(acpi_perf_data); |
501 | 501 | ||
502 | for_each_possible_cpu(i) { | 502 | for_each_possible_cpu(i) { |
503 | struct acpi_processor *pr; | ||
503 | struct acpi_processor_performance *perf; | 504 | struct acpi_processor_performance *perf; |
504 | 505 | ||
506 | pr = per_cpu(processors, i); | ||
505 | perf = per_cpu_ptr(acpi_perf_data, i); | 507 | perf = per_cpu_ptr(acpi_perf_data, i); |
506 | rc = acpi_processor_register_performance(perf, i); | 508 | if (!pr) |
509 | continue; | ||
510 | |||
511 | pr->performance = perf; | ||
512 | rc = acpi_processor_get_performance_info(pr); | ||
507 | if (rc) | 513 | if (rc) |
508 | goto err_out; | 514 | goto err_out; |
509 | } | 515 | } |
510 | rc = acpi_processor_notify_smm(THIS_MODULE); | ||
511 | if (rc) | ||
512 | goto err_unregister; | ||
513 | 516 | ||
514 | for_each_possible_cpu(i) { | 517 | for_each_possible_cpu(i) { |
515 | struct acpi_processor *_pr; | 518 | struct acpi_processor *_pr; |
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 9204126f1560..a2278ba7fb27 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <xen/events.h> | 17 | #include <xen/events.h> |
18 | #include <asm/xen/pci.h> | 18 | #include <asm/xen/pci.h> |
19 | #include <asm/xen/hypervisor.h> | 19 | #include <asm/xen/hypervisor.h> |
20 | #include <xen/interface/physdev.h> | ||
20 | #include "pciback.h" | 21 | #include "pciback.h" |
21 | #include "conf_space.h" | 22 | #include "conf_space.h" |
22 | #include "conf_space_quirks.h" | 23 | #include "conf_space_quirks.h" |
@@ -85,37 +86,52 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev) | |||
85 | static void pcistub_device_release(struct kref *kref) | 86 | static void pcistub_device_release(struct kref *kref) |
86 | { | 87 | { |
87 | struct pcistub_device *psdev; | 88 | struct pcistub_device *psdev; |
89 | struct pci_dev *dev; | ||
88 | struct xen_pcibk_dev_data *dev_data; | 90 | struct xen_pcibk_dev_data *dev_data; |
89 | 91 | ||
90 | psdev = container_of(kref, struct pcistub_device, kref); | 92 | psdev = container_of(kref, struct pcistub_device, kref); |
91 | dev_data = pci_get_drvdata(psdev->dev); | 93 | dev = psdev->dev; |
94 | dev_data = pci_get_drvdata(dev); | ||
92 | 95 | ||
93 | dev_dbg(&psdev->dev->dev, "pcistub_device_release\n"); | 96 | dev_dbg(&dev->dev, "pcistub_device_release\n"); |
94 | 97 | ||
95 | xen_unregister_device_domain_owner(psdev->dev); | 98 | xen_unregister_device_domain_owner(dev); |
96 | 99 | ||
97 | /* Call the reset function which does not take lock as this | 100 | /* Call the reset function which does not take lock as this |
98 | * is called from "unbind" which takes a device_lock mutex. | 101 | * is called from "unbind" which takes a device_lock mutex. |
99 | */ | 102 | */ |
100 | __pci_reset_function_locked(psdev->dev); | 103 | __pci_reset_function_locked(dev); |
101 | if (pci_load_and_free_saved_state(psdev->dev, | 104 | if (pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) |
102 | &dev_data->pci_saved_state)) { | 105 | dev_dbg(&dev->dev, "Could not reload PCI state\n"); |
103 | dev_dbg(&psdev->dev->dev, "Could not reload PCI state\n"); | 106 | else |
104 | } else | 107 | pci_restore_state(dev); |
105 | pci_restore_state(psdev->dev); | 108 | |
109 | if (pci_find_capability(dev, PCI_CAP_ID_MSIX)) { | ||
110 | struct physdev_pci_device ppdev = { | ||
111 | .seg = pci_domain_nr(dev->bus), | ||
112 | .bus = dev->bus->number, | ||
113 | .devfn = dev->devfn | ||
114 | }; | ||
115 | int err = HYPERVISOR_physdev_op(PHYSDEVOP_release_msix, | ||
116 | &ppdev); | ||
117 | |||
118 | if (err) | ||
119 | dev_warn(&dev->dev, "MSI-X release failed (%d)\n", | ||
120 | err); | ||
121 | } | ||
106 | 122 | ||
107 | /* Disable the device */ | 123 | /* Disable the device */ |
108 | xen_pcibk_reset_device(psdev->dev); | 124 | xen_pcibk_reset_device(dev); |
109 | 125 | ||
110 | kfree(dev_data); | 126 | kfree(dev_data); |
111 | pci_set_drvdata(psdev->dev, NULL); | 127 | pci_set_drvdata(dev, NULL); |
112 | 128 | ||
113 | /* Clean-up the device */ | 129 | /* Clean-up the device */ |
114 | xen_pcibk_config_free_dyn_fields(psdev->dev); | 130 | xen_pcibk_config_free_dyn_fields(dev); |
115 | xen_pcibk_config_free_dev(psdev->dev); | 131 | xen_pcibk_config_free_dev(dev); |
116 | 132 | ||
117 | psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; | 133 | dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; |
118 | pci_dev_put(psdev->dev); | 134 | pci_dev_put(dev); |
119 | 135 | ||
120 | kfree(psdev); | 136 | kfree(psdev); |
121 | } | 137 | } |
@@ -355,6 +371,19 @@ static int pcistub_init_device(struct pci_dev *dev) | |||
355 | if (err) | 371 | if (err) |
356 | goto config_release; | 372 | goto config_release; |
357 | 373 | ||
374 | if (pci_find_capability(dev, PCI_CAP_ID_MSIX)) { | ||
375 | struct physdev_pci_device ppdev = { | ||
376 | .seg = pci_domain_nr(dev->bus), | ||
377 | .bus = dev->bus->number, | ||
378 | .devfn = dev->devfn | ||
379 | }; | ||
380 | |||
381 | err = HYPERVISOR_physdev_op(PHYSDEVOP_prepare_msix, &ppdev); | ||
382 | if (err) | ||
383 | dev_err(&dev->dev, "MSI-X preparation failed (%d)\n", | ||
384 | err); | ||
385 | } | ||
386 | |||
358 | /* We need the device active to save the state. */ | 387 | /* We need the device active to save the state. */ |
359 | dev_dbg(&dev->dev, "save state of device\n"); | 388 | dev_dbg(&dev->dev, "save state of device\n"); |
360 | pci_save_state(dev); | 389 | pci_save_state(dev); |
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 37c1f825f513..b98cf0c35725 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c | |||
@@ -113,7 +113,8 @@ void xen_pcibk_reset_device(struct pci_dev *dev) | |||
113 | if (dev->msi_enabled) | 113 | if (dev->msi_enabled) |
114 | pci_disable_msi(dev); | 114 | pci_disable_msi(dev); |
115 | #endif | 115 | #endif |
116 | pci_disable_device(dev); | 116 | if (pci_is_enabled(dev)) |
117 | pci_disable_device(dev); | ||
117 | 118 | ||
118 | pci_write_config_word(dev, PCI_COMMAND, 0); | 119 | pci_write_config_word(dev, PCI_COMMAND, 0); |
119 | 120 | ||
diff --git a/drivers/xen/xen-stub.c b/drivers/xen/xen-stub.c index d85e411cbf89..bbef194c5b01 100644 --- a/drivers/xen/xen-stub.c +++ b/drivers/xen/xen-stub.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/export.h> | 25 | #include <linux/export.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/acpi.h> | 27 | #include <linux/acpi.h> |
28 | #include <acpi/acpi_drivers.h> | ||
29 | #include <xen/acpi.h> | 28 | #include <xen/acpi.h> |
30 | 29 | ||
31 | #ifdef CONFIG_ACPI | 30 | #ifdef CONFIG_ACPI |