aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2010-04-15 00:19:48 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-05-11 15:01:37 -0400
commit4f7ccf6a6085eefd2517b8c7090608c64b01ab67 (patch)
tree41d6a5d595bb14cc537333e278f1a3ed4fc19cc4 /drivers/pci
parente167bfcaa4cd44b4c66206a3c06b2aafb3f1260e (diff)
PCI: aerdrv: remove is_downstream
The pcie->port of port service device points the port associated the service with. The find_aer_service iterates over children of given port udev. So it is clear that the pcie->port of port service of given port udev must always point the udev. Therefore we can know the type of udev without checking its children. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 9dcd3aeeafb6..8d458a03afc9 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -375,30 +375,20 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,
375 375
376struct find_aer_service_data { 376struct find_aer_service_data {
377 struct pcie_port_service_driver *aer_driver; 377 struct pcie_port_service_driver *aer_driver;
378 int is_downstream;
379}; 378};
380 379
381static int find_aer_service_iter(struct device *device, void *data) 380static int find_aer_service_iter(struct device *device, void *data)
382{ 381{
383 struct device_driver *driver;
384 struct pcie_port_service_driver *service_driver; 382 struct pcie_port_service_driver *service_driver;
385 struct find_aer_service_data *result; 383 struct find_aer_service_data *result;
386 384
387 result = (struct find_aer_service_data *) data; 385 result = (struct find_aer_service_data *) data;
388 386
389 if (device->bus == &pcie_port_bus_type) { 387 if (device->bus == &pcie_port_bus_type && device->driver) {
390 struct pcie_device *pcie = to_pcie_device(device); 388 service_driver = to_service_driver(device->driver);
391 389 if (service_driver->service == PCIE_PORT_SERVICE_AER) {
392 if (pcie->port->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) 390 result->aer_driver = service_driver;
393 result->is_downstream = 1; 391 return 1;
394
395 driver = device->driver;
396 if (driver) {
397 service_driver = to_service_driver(driver);
398 if (service_driver->service == PCIE_PORT_SERVICE_AER) {
399 result->aer_driver = service_driver;
400 return 1;
401 }
402 } 392 }
403 } 393 }
404 394
@@ -424,7 +414,6 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
424 else 414 else
425 udev = dev->bus->self; 415 udev = dev->bus->self;
426 416
427 data.is_downstream = 0;
428 data.aer_driver = NULL; 417 data.aer_driver = NULL;
429 find_aer_service(udev, &data); 418 find_aer_service(udev, &data);
430 419
@@ -433,22 +422,24 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
433 * If it hasn't the aer driver, use the root port's 422 * If it hasn't the aer driver, use the root port's
434 */ 423 */
435 if (!data.aer_driver || !data.aer_driver->reset_link) { 424 if (!data.aer_driver || !data.aer_driver->reset_link) {
436 if (data.is_downstream && 425 if (udev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM &&
437 aerdev->device.driver && 426 aerdev->device.driver &&
438 to_service_driver(aerdev->device.driver)->reset_link) { 427 to_service_driver(aerdev->device.driver)->reset_link) {
439 data.aer_driver = 428 data.aer_driver =
440 to_service_driver(aerdev->device.driver); 429 to_service_driver(aerdev->device.driver);
441 } else { 430 } else {
442 dev_printk(KERN_DEBUG, &dev->dev, "no link-reset " 431 dev_printk(KERN_DEBUG, &dev->dev,
443 "support\n"); 432 "no link-reset support at upstream device %s\n",
433 pci_name(udev));
444 return PCI_ERS_RESULT_DISCONNECT; 434 return PCI_ERS_RESULT_DISCONNECT;
445 } 435 }
446 } 436 }
447 437
448 status = data.aer_driver->reset_link(udev); 438 status = data.aer_driver->reset_link(udev);
449 if (status != PCI_ERS_RESULT_RECOVERED) { 439 if (status != PCI_ERS_RESULT_RECOVERED) {
450 dev_printk(KERN_DEBUG, &dev->dev, "link reset at upstream " 440 dev_printk(KERN_DEBUG, &dev->dev,
451 "device %s failed\n", pci_name(udev)); 441 "link reset at upstream device %s failed\n",
442 pci_name(udev));
452 return PCI_ERS_RESULT_DISCONNECT; 443 return PCI_ERS_RESULT_DISCONNECT;
453 } 444 }
454 445