aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/pci/hotplug/shpchp_pci.c
diff options
context:
space:
mode:
authorrajesh.shah@intel.com <rajesh.shah@intel.com>2005-10-13 12:05:41 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 15:37:00 -0700
commit2178bfad9ccb0cbeb79599dd1dc349dd4567aa49 (patch)
tree9a58ee4a73e36b31edd8b5660966403d7c6c5562 /drivers/pci/hotplug/shpchp_pci.c
parent[PATCH] shpchp: dont save PCI config for hotplug slots/devices (diff)
downloadwireguard-linux-2178bfad9ccb0cbeb79599dd1dc349dd4567aa49.tar.xz
wireguard-linux-2178bfad9ccb0cbeb79599dd1dc349dd4567aa49.zip
[PATCH] shpchp: remove redundant data structures
State information is currently stored in per-slot as well as per-pci-function data structures in shpchp. There's a lot of overlap in the information kept, and some of it is never used. This patch consolidates the state information to per-slot and eliminates unused data structures. The biggest change is to eliminate the pci_func structure and the code around managing its lists. Signed-off-by: Rajesh Shah <rajesh.shah@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp_pci.c')
-rw-r--r--drivers/pci/hotplug/shpchp_pci.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
index f51a97d7611f..8f0a1667f2e6 100644
--- a/drivers/pci/hotplug/shpchp_pci.c
+++ b/drivers/pci/hotplug/shpchp_pci.c
@@ -148,20 +148,33 @@ int shpchp_configure_device(struct slot *p_slot)
return 0;
}
-int shpchp_unconfigure_device(struct pci_func* func)
+int shpchp_unconfigure_device(struct slot *p_slot)
{
int rc = 0;
int j;
+ u8 bctl = 0;
- dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus,
- func->device, func->function);
+ dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, p_slot->device);
for (j=0; j<8 ; j++) {
- struct pci_dev* temp = pci_find_slot(func->bus,
- (func->device << 3) | j);
- if (temp) {
- pci_remove_bus_device(temp);
+ struct pci_dev* temp = pci_find_slot(p_slot->bus,
+ (p_slot->device << 3) | j);
+ if (!temp)
+ continue;
+ if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
+ err("Cannot remove display device %s\n",
+ pci_name(temp));
+ continue;
+ }
+ if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+ pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl);
+ if (bctl & PCI_BRIDGE_CTL_VGA) {
+ err("Cannot remove display device %s\n",
+ pci_name(temp));
+ continue;
+ }
}
+ pci_remove_bus_device(temp);
}
return rc;
}