Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI Hotplug: acpiphp: don't store a pci_dev in acpiphp_func

+26 -38
-1
drivers/pci/hotplug/acpiphp.h
··· 129 129 struct acpiphp_bridge *bridge; /* Ejectable PCI-to-PCI bridge */ 130 130 131 131 struct list_head sibling; 132 - struct pci_dev *pci_dev; 133 132 struct notifier_block nb; 134 133 acpi_handle handle; 135 134
+26 -37
drivers/pci/hotplug/acpiphp_glue.c
··· 32 32 33 33 /* 34 34 * Lifetime rules for pci_dev: 35 - * - The one in acpiphp_func has its refcount elevated by pci_get_slot() 36 - * when the driver is loaded or when an insertion event occurs. It loses 37 - * a refcount when its ejected or the driver unloads. 38 35 * - The one in acpiphp_bridge has its refcount elevated by pci_get_slot() 39 36 * when the bridge is scanned and it loses a refcount when the bridge 40 37 * is removed. ··· 127 130 unsigned long long adr, sun; 128 131 int device, function, retval; 129 132 struct pci_bus *pbus = bridge->pci_bus; 133 + struct pci_dev *pdev; 130 134 131 135 if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) 132 136 return AE_OK; ··· 211 213 newfunc->slot = slot; 212 214 list_add_tail(&newfunc->sibling, &slot->funcs); 213 215 214 - /* associate corresponding pci_dev */ 215 - newfunc->pci_dev = pci_get_slot(pbus, PCI_DEVFN(device, function)); 216 - if (newfunc->pci_dev) { 216 + pdev = pci_get_slot(pbus, PCI_DEVFN(device, function)); 217 + if (pdev) { 217 218 slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); 219 + pci_dev_put(pdev); 218 220 } 219 221 220 222 if (is_dock_device(handle)) { ··· 615 617 if (ACPI_FAILURE(status)) 616 618 err("failed to remove notify handler\n"); 617 619 } 618 - pci_dev_put(func->pci_dev); 619 620 list_del(list); 620 621 kfree(func); 621 622 } ··· 1098 1101 pci_enable_bridges(bus); 1099 1102 pci_bus_add_devices(bus); 1100 1103 1101 - /* associate pci_dev to our representation */ 1102 1104 list_for_each (l, &slot->funcs) { 1103 1105 func = list_entry(l, struct acpiphp_func, sibling); 1104 - func->pci_dev = pci_get_slot(bus, PCI_DEVFN(slot->device, 1105 - func->function)); 1106 - if (!func->pci_dev) 1106 + dev = pci_get_slot(bus, PCI_DEVFN(slot->device, 1107 + func->function)); 1108 + if (!dev) 1107 1109 continue; 1108 1110 1109 - if (func->pci_dev->hdr_type != PCI_HEADER_TYPE_BRIDGE && 1110 - func->pci_dev->hdr_type != PCI_HEADER_TYPE_CARDBUS) 1111 + if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE && 1112 + dev->hdr_type != PCI_HEADER_TYPE_CARDBUS) { 1113 + pci_dev_put(dev); 1111 1114 continue; 1115 + } 1112 1116 1113 1117 status = find_p2p_bridge(func->handle, (u32)1, bus, NULL); 1114 1118 if (ACPI_FAILURE(status)) 1115 1119 warn("find_p2p_bridge failed (error code = 0x%x)\n", 1116 1120 status); 1121 + pci_dev_put(dev); 1117 1122 } 1118 1123 1119 1124 slot->flags |= SLOT_ENABLED; ··· 1141 1142 */ 1142 1143 static int disable_device(struct acpiphp_slot *slot) 1143 1144 { 1144 - int retval = 0; 1145 1145 struct acpiphp_func *func; 1146 - struct list_head *l; 1146 + struct pci_dev *pdev; 1147 1147 1148 1148 /* is this slot already disabled? */ 1149 1149 if (!(slot->flags & SLOT_ENABLED)) 1150 1150 goto err_exit; 1151 1151 1152 - list_for_each (l, &slot->funcs) { 1153 - func = list_entry(l, struct acpiphp_func, sibling); 1154 - 1152 + list_for_each_entry(func, &slot->funcs, sibling) { 1155 1153 if (func->bridge) { 1156 1154 /* cleanup p2p bridges under this P2P bridge */ 1157 1155 cleanup_p2p_bridge(func->bridge->handle, ··· 1156 1160 func->bridge = NULL; 1157 1161 } 1158 1162 1159 - if (func->pci_dev) { 1160 - pci_stop_bus_device(func->pci_dev); 1161 - if (func->pci_dev->subordinate) { 1162 - disable_bridges(func->pci_dev->subordinate); 1163 - pci_disable_device(func->pci_dev); 1163 + pdev = pci_get_slot(slot->bridge->pci_bus, 1164 + PCI_DEVFN(slot->device, func->function)); 1165 + if (pdev) { 1166 + pci_stop_bus_device(pdev); 1167 + if (pdev->subordinate) { 1168 + disable_bridges(pdev->subordinate); 1169 + pci_disable_device(pdev); 1164 1170 } 1171 + pci_remove_bus_device(pdev); 1172 + pci_dev_put(pdev); 1165 1173 } 1166 1174 } 1167 1175 1168 - list_for_each (l, &slot->funcs) { 1169 - func = list_entry(l, struct acpiphp_func, sibling); 1170 - 1176 + list_for_each_entry(func, &slot->funcs, sibling) { 1171 1177 acpiphp_unconfigure_ioapics(func->handle); 1172 1178 acpiphp_bus_trim(func->handle); 1173 - /* try to remove anyway. 1174 - * acpiphp_bus_add might have been failed */ 1175 - 1176 - if (!func->pci_dev) 1177 - continue; 1178 - 1179 - pci_remove_bus_device(func->pci_dev); 1180 - pci_dev_put(func->pci_dev); 1181 - func->pci_dev = NULL; 1182 1179 } 1183 1180 1184 1181 slot->flags &= (~SLOT_ENABLED); 1185 1182 1186 - err_exit: 1187 - return retval; 1183 + err_exit: 1184 + return 0; 1188 1185 } 1189 1186 1190 1187