diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-13 17:27:26 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-22 22:00:28 -0400 |
commit | a1d0abcea845730c4ff2f47897e28c2f11c79d4f (patch) | |
tree | f1ea8c41befa9fd0f396923ee31dcb7753349061 | |
parent | 1ad3790ac7cfac699993a3f2e189a69a82f8fe4d (diff) |
ACPI / hotplug / PCI: Redefine enable_device() and disable_device()
Notice that functions enable_device() and disable_device() cannot
fail and their return values are ignored in the majority of places,
so redefine them as void and use the opportunity to change their
names to enable_slot() and disable_slot(), respectively, which much
better reflects what they do.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index d8748a4a18a7..18c9e54990ee 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -532,13 +532,13 @@ static void check_hotplug_bridge(struct acpiphp_slot *slot, struct pci_dev *dev) | |||
532 | } | 532 | } |
533 | 533 | ||
534 | /** | 534 | /** |
535 | * enable_device - enable, configure a slot | 535 | * enable_slot - enable, configure a slot |
536 | * @slot: slot to be enabled | 536 | * @slot: slot to be enabled |
537 | * | 537 | * |
538 | * This function should be called per *physical slot*, | 538 | * This function should be called per *physical slot*, |
539 | * not per each slot object in ACPI namespace. | 539 | * not per each slot object in ACPI namespace. |
540 | */ | 540 | */ |
541 | static int __ref enable_device(struct acpiphp_slot *slot) | 541 | static void __ref enable_slot(struct acpiphp_slot *slot) |
542 | { | 542 | { |
543 | struct pci_dev *dev; | 543 | struct pci_dev *dev; |
544 | struct pci_bus *bus = slot->bus; | 544 | struct pci_bus *bus = slot->bus; |
@@ -556,6 +556,7 @@ static int __ref enable_device(struct acpiphp_slot *slot) | |||
556 | list_for_each_entry(dev, &bus->devices, bus_list) { | 556 | list_for_each_entry(dev, &bus->devices, bus_list) { |
557 | if (PCI_SLOT(dev->devfn) != slot->device) | 557 | if (PCI_SLOT(dev->devfn) != slot->device) |
558 | continue; | 558 | continue; |
559 | |||
559 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 560 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
560 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { | 561 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { |
561 | max = pci_scan_bridge(bus, dev, max, pass); | 562 | max = pci_scan_bridge(bus, dev, max, pass); |
@@ -594,8 +595,6 @@ static int __ref enable_device(struct acpiphp_slot *slot) | |||
594 | continue; | 595 | continue; |
595 | } | 596 | } |
596 | } | 597 | } |
597 | |||
598 | return 0; | ||
599 | } | 598 | } |
600 | 599 | ||
601 | /* return first device in slot, acquiring a reference on it */ | 600 | /* return first device in slot, acquiring a reference on it */ |
@@ -617,16 +616,16 @@ static struct pci_dev *dev_in_slot(struct acpiphp_slot *slot) | |||
617 | } | 616 | } |
618 | 617 | ||
619 | /** | 618 | /** |
620 | * disable_device - disable a slot | 619 | * disable_slot - disable a slot |
621 | * @slot: ACPI PHP slot | 620 | * @slot: ACPI PHP slot |
622 | */ | 621 | */ |
623 | static int disable_device(struct acpiphp_slot *slot) | 622 | static void disable_slot(struct acpiphp_slot *slot) |
624 | { | 623 | { |
625 | struct acpiphp_func *func; | 624 | struct acpiphp_func *func; |
626 | struct pci_dev *pdev; | 625 | struct pci_dev *pdev; |
627 | 626 | ||
628 | /* | 627 | /* |
629 | * enable_device() enumerates all functions in this device via | 628 | * enable_slot() enumerates all functions in this device via |
630 | * pci_scan_slot(), whether they have associated ACPI hotplug | 629 | * pci_scan_slot(), whether they have associated ACPI hotplug |
631 | * methods (_EJ0, etc.) or not. Therefore, we remove all functions | 630 | * methods (_EJ0, etc.) or not. Therefore, we remove all functions |
632 | * here. | 631 | * here. |
@@ -640,8 +639,6 @@ static int disable_device(struct acpiphp_slot *slot) | |||
640 | acpiphp_bus_trim(func_to_handle(func)); | 639 | acpiphp_bus_trim(func_to_handle(func)); |
641 | 640 | ||
642 | slot->flags &= (~SLOT_ENABLED); | 641 | slot->flags &= (~SLOT_ENABLED); |
643 | |||
644 | return 0; | ||
645 | } | 642 | } |
646 | 643 | ||
647 | 644 | ||
@@ -751,9 +748,9 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
751 | trim_stale_devices(dev); | 748 | trim_stale_devices(dev); |
752 | 749 | ||
753 | /* configure all functions */ | 750 | /* configure all functions */ |
754 | enable_device(slot); | 751 | enable_slot(slot); |
755 | } else { | 752 | } else { |
756 | disable_device(slot); | 753 | disable_slot(slot); |
757 | } | 754 | } |
758 | mutex_unlock(&slot->crit_sect); | 755 | mutex_unlock(&slot->crit_sect); |
759 | } | 756 | } |
@@ -860,7 +857,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) | |||
860 | struct acpiphp_slot *slot = func->slot; | 857 | struct acpiphp_slot *slot = func->slot; |
861 | 858 | ||
862 | mutex_lock(&slot->crit_sect); | 859 | mutex_lock(&slot->crit_sect); |
863 | enable_device(slot); | 860 | enable_slot(slot); |
864 | mutex_unlock(&slot->crit_sect); | 861 | mutex_unlock(&slot->crit_sect); |
865 | } | 862 | } |
866 | break; | 863 | break; |
@@ -1047,16 +1044,13 @@ void acpiphp_remove_slots(struct pci_bus *bus) | |||
1047 | */ | 1044 | */ |
1048 | int acpiphp_enable_slot(struct acpiphp_slot *slot) | 1045 | int acpiphp_enable_slot(struct acpiphp_slot *slot) |
1049 | { | 1046 | { |
1050 | int retval = 0; | ||
1051 | |||
1052 | mutex_lock(&slot->crit_sect); | 1047 | mutex_lock(&slot->crit_sect); |
1053 | |||
1054 | /* configure all functions */ | 1048 | /* configure all functions */ |
1055 | if (!(slot->flags & SLOT_ENABLED)) | 1049 | if (!(slot->flags & SLOT_ENABLED)) |
1056 | retval = enable_device(slot); | 1050 | enable_slot(slot); |
1057 | 1051 | ||
1058 | mutex_unlock(&slot->crit_sect); | 1052 | mutex_unlock(&slot->crit_sect); |
1059 | return retval; | 1053 | return 0; |
1060 | } | 1054 | } |
1061 | 1055 | ||
1062 | /** | 1056 | /** |
@@ -1071,9 +1065,7 @@ int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) | |||
1071 | mutex_lock(&slot->crit_sect); | 1065 | mutex_lock(&slot->crit_sect); |
1072 | 1066 | ||
1073 | /* unconfigure all functions */ | 1067 | /* unconfigure all functions */ |
1074 | retval = disable_device(slot); | 1068 | disable_slot(slot); |
1075 | if (retval) | ||
1076 | goto err_exit; | ||
1077 | 1069 | ||
1078 | list_for_each_entry(func, &slot->funcs, sibling) | 1070 | list_for_each_entry(func, &slot->funcs, sibling) |
1079 | if (func->flags & FUNC_HAS_EJ0) { | 1071 | if (func->flags & FUNC_HAS_EJ0) { |
@@ -1085,7 +1077,6 @@ int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) | |||
1085 | break; | 1077 | break; |
1086 | } | 1078 | } |
1087 | 1079 | ||
1088 | err_exit: | ||
1089 | mutex_unlock(&slot->crit_sect); | 1080 | mutex_unlock(&slot->crit_sect); |
1090 | return retval; | 1081 | return retval; |
1091 | } | 1082 | } |