diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-11-30 20:34:37 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-12-02 16:01:49 -0500 |
| commit | 8496e85c20e7836b3dec97780e40f420a3ae2801 (patch) | |
| tree | 9859b6aad0ebc29acd964d46b8236b6af05b8ec4 /drivers/pci | |
| parent | 30e56918dd1e6d64350661f186657f6a6f2646e6 (diff) | |
PCI / tg3: Give up chip reset and carrier loss handling if PCI device is not present
Modify tg3_chip_reset() and tg3_close() to check if the PCI network
adapter device is accessible at all in order to skip poking it or
trying to handle a carrier loss in vain when that's not the case.
Introduce a special PCI helper function pci_device_is_present()
for this purpose.
Of course, this uncovers the lack of the appropriate RTNL locking
in tg3_suspend() and tg3_resume(), so add that locking in there
too.
These changes prevent tg3 from burning a CPU at 100% load level for
solid several seconds after the Thunderbolt link is disconnected from
a Matrox DS1 docking station.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/pci')
| -rw-r--r-- | drivers/pci/pci.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 33120d156668..07369f32e8bb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -4165,6 +4165,14 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, | |||
| 4165 | return 0; | 4165 | return 0; |
| 4166 | } | 4166 | } |
| 4167 | 4167 | ||
| 4168 | bool pci_device_is_present(struct pci_dev *pdev) | ||
| 4169 | { | ||
| 4170 | u32 v; | ||
| 4171 | |||
| 4172 | return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0); | ||
| 4173 | } | ||
| 4174 | EXPORT_SYMBOL_GPL(pci_device_is_present); | ||
| 4175 | |||
| 4168 | #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE | 4176 | #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE |
| 4169 | static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0}; | 4177 | static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0}; |
| 4170 | static DEFINE_SPINLOCK(resource_alignment_lock); | 4178 | static DEFINE_SPINLOCK(resource_alignment_lock); |
