diff options
author | rajesh.shah@intel.com <rajesh.shah@intel.com> | 2005-10-13 15:05:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 18:37:00 -0400 |
commit | 1410dc1cef1e2f5e90c1fcb97041f42e0eee35b4 (patch) | |
tree | dffc17757791d79f2a83b5a85cf21278f3803448 /drivers | |
parent | 424600f9706b20a8a33ad928d3d0326bd88679bc (diff) |
[PATCH] shpchp: detect SHPC capability before doing a lot of work
The shpc driver registers its probe function for all pci-pci
bridges in the system. Not all of them will be shpc capable, so
look for this capability early in the probe function and return
if there's no work to do on this bridge. The old shpc driver
did some initialization work on all bridges before detecting
that shpc is not supported and unwinds the work it's already done
in that case.
Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index e3c0c17295da..3132d60a79f5 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -351,6 +351,17 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp | |||
351 | return 0; | 351 | return 0; |
352 | } | 352 | } |
353 | 353 | ||
354 | static int is_shpc_capable(struct pci_dev *dev) | ||
355 | { | ||
356 | if ((dev->vendor == PCI_VENDOR_ID_AMD) || (dev->device == | ||
357 | PCI_DEVICE_ID_AMD_GOLAM_7450)) | ||
358 | return 1; | ||
359 | if (pci_find_capability(dev, PCI_CAP_ID_SHPC)) | ||
360 | return 1; | ||
361 | |||
362 | return 0; | ||
363 | } | ||
364 | |||
354 | static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 365 | static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
355 | { | 366 | { |
356 | int rc; | 367 | int rc; |
@@ -359,6 +370,9 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
359 | int first_device_num; /* first PCI device number supported by this SHPC */ | 370 | int first_device_num; /* first PCI device number supported by this SHPC */ |
360 | int num_ctlr_slots; /* number of slots supported by this SHPC */ | 371 | int num_ctlr_slots; /* number of slots supported by this SHPC */ |
361 | 372 | ||
373 | if (!is_shpc_capable(pdev)) | ||
374 | return -ENODEV; | ||
375 | |||
362 | ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL); | 376 | ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL); |
363 | if (!ctrl) { | 377 | if (!ctrl) { |
364 | err("%s : out of memory\n", __FUNCTION__); | 378 | err("%s : out of memory\n", __FUNCTION__); |