Lines Matching full:bridge
22 * when the bridge is scanned and it loses a refcount when the bridge
24 * - When a P2P bridge is present, we elevate the refcount on the subordinate
105 WARN_ON(context->bridge); in acpiphp_put_context()
110 static inline void get_bridge(struct acpiphp_bridge *bridge) in get_bridge() argument
112 kref_get(&bridge->ref); in get_bridge()
115 static inline void put_bridge(struct acpiphp_bridge *bridge) in put_bridge() argument
117 kref_put(&bridge->ref, free_bridge); in put_bridge()
152 struct acpiphp_bridge *bridge; in free_bridge() local
158 bridge = container_of(kref, struct acpiphp_bridge, ref); in free_bridge()
160 list_for_each_entry_safe(slot, next, &bridge->slots, node) { in free_bridge()
167 context = bridge->context; in free_bridge()
172 context->bridge = NULL; in free_bridge()
176 put_device(&bridge->pci_bus->dev); in free_bridge()
177 pci_dev_put(bridge->pci_dev); in free_bridge()
178 kfree(bridge); in free_bridge()
203 * secondary bridge on slot in acpiphp_post_dock_fixup()
223 * @data: The object's parent ACPIPHP bridge.
229 struct acpiphp_bridge *bridge = data; in acpiphp_add_context() local
237 struct pci_bus *pbus = bridge->pci_bus; in acpiphp_add_context()
238 struct pci_dev *pdev = bridge->pci_dev; in acpiphp_add_context()
263 newfunc->parent = bridge; in acpiphp_add_context()
277 list_for_each_entry(slot, &bridge->slots, node) in acpiphp_add_context()
289 slot->bus = bridge->pci_bus; in acpiphp_add_context()
293 list_add_tail(&slot->node, &bridge->slots); in acpiphp_add_context()
307 bridge->nr_slots++; in acpiphp_add_context()
310 sun = bridge->nr_slots; in acpiphp_add_context()
318 bridge->nr_slots--; in acpiphp_add_context()
338 static void cleanup_bridge(struct acpiphp_bridge *bridge) in cleanup_bridge() argument
343 list_for_each_entry(slot, &bridge->slots, node) { in cleanup_bridge()
358 list_del(&bridge->list); in cleanup_bridge()
362 bridge->is_going_away = true; in cleanup_bridge()
435 static void acpiphp_native_scan_bridge(struct pci_dev *bridge) in acpiphp_native_scan_bridge() argument
437 struct pci_bus *bus = bridge->subordinate; in acpiphp_native_scan_bridge()
468 * @bridge: true if enable is for the whole bridge (not a single slot)
473 static void enable_slot(struct acpiphp_slot *slot, bool bridge) in enable_slot() argument
479 if (bridge && bus->self && hotplug_is_native(bus->self)) { in enable_slot()
671 /* The device is a bridge. so check the bus below it. */ in trim_stale_devices()
682 * @bridge: where to begin re-enumeration
684 * Iterate over all slots under this bridge and make sure that if a
687 static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) in acpiphp_check_bridge() argument
691 /* Bail out if the bridge is going away. */ in acpiphp_check_bridge()
692 if (bridge->is_going_away) in acpiphp_check_bridge()
695 if (bridge->pci_dev) in acpiphp_check_bridge()
696 pm_runtime_get_sync(&bridge->pci_dev->dev); in acpiphp_check_bridge()
698 list_for_each_entry(slot, &bridge->slots, node) { in acpiphp_check_bridge()
718 if (bridge->pci_dev) in acpiphp_check_bridge()
719 pm_runtime_put(&bridge->pci_dev->dev); in acpiphp_check_bridge()
752 struct acpiphp_bridge *bridge = NULL; in acpiphp_check_host_bridge() local
756 bridge = to_acpiphp_root_context(adev->hp)->root_bridge; in acpiphp_check_host_bridge()
757 if (bridge) in acpiphp_check_host_bridge()
758 get_bridge(bridge); in acpiphp_check_host_bridge()
761 if (bridge) { in acpiphp_check_host_bridge()
764 acpiphp_check_bridge(bridge); in acpiphp_check_host_bridge()
767 put_bridge(bridge); in acpiphp_check_host_bridge()
778 struct acpiphp_bridge *bridge; in hotplug_event() local
781 bridge = context->bridge; in hotplug_event()
782 if (bridge) in hotplug_event()
783 get_bridge(bridge); in hotplug_event()
793 if (bridge) in hotplug_event()
794 acpiphp_check_bridge(bridge); in hotplug_event()
803 if (bridge) { in hotplug_event()
804 acpiphp_check_bridge(bridge); in hotplug_event()
823 if (bridge) in hotplug_event()
824 put_bridge(bridge); in hotplug_event()
849 struct acpiphp_bridge *bridge; in acpiphp_enumerate_slots() local
857 adev = ACPI_COMPANION(bus->bridge); in acpiphp_enumerate_slots()
862 bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); in acpiphp_enumerate_slots()
863 if (!bridge) in acpiphp_enumerate_slots()
866 INIT_LIST_HEAD(&bridge->slots); in acpiphp_enumerate_slots()
867 kref_init(&bridge->ref); in acpiphp_enumerate_slots()
868 bridge->pci_dev = pci_dev_get(bus->self); in acpiphp_enumerate_slots()
869 bridge->pci_bus = bus; in acpiphp_enumerate_slots()
879 if (pci_is_root_bus(bridge->pci_bus)) { in acpiphp_enumerate_slots()
886 root_context->root_bridge = bridge; in acpiphp_enumerate_slots()
892 * This bridge should have been registered as a hotplug function in acpiphp_enumerate_slots()
895 * bridge is not interesting to us either. in acpiphp_enumerate_slots()
901 bridge->context = context; in acpiphp_enumerate_slots()
902 context->bridge = bridge; in acpiphp_enumerate_slots()
903 /* Get a reference to the parent bridge. */ in acpiphp_enumerate_slots()
910 list_add(&bridge->list, &bridge_list); in acpiphp_enumerate_slots()
913 /* register all slot objects under this bridge */ in acpiphp_enumerate_slots()
915 acpiphp_add_context, NULL, bridge, NULL); in acpiphp_enumerate_slots()
918 cleanup_bridge(bridge); in acpiphp_enumerate_slots()
919 put_bridge(bridge); in acpiphp_enumerate_slots()
926 pci_dev_put(bridge->pci_dev); in acpiphp_enumerate_slots()
927 kfree(bridge); in acpiphp_enumerate_slots()
930 static void acpiphp_drop_bridge(struct acpiphp_bridge *bridge) in acpiphp_drop_bridge() argument
932 if (pci_is_root_bus(bridge->pci_bus)) { in acpiphp_drop_bridge()
937 adev = ACPI_COMPANION(bridge->pci_bus->bridge); in acpiphp_drop_bridge()
943 cleanup_bridge(bridge); in acpiphp_drop_bridge()
944 put_bridge(bridge); in acpiphp_drop_bridge()
953 struct acpiphp_bridge *bridge; in acpiphp_remove_slots() local
959 list_for_each_entry(bridge, &bridge_list, list) in acpiphp_remove_slots()
960 if (bridge->pci_bus == bus) { in acpiphp_remove_slots()
962 acpiphp_drop_bridge(bridge); in acpiphp_remove_slots()