From patchwork Thu Apr 15 04:19:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hidetoshi Seto X-Patchwork-Id: 92651 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3F4K4C7015852 for ; Thu, 15 Apr 2010 04:20:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883Ab0DOEUC (ORCPT ); Thu, 15 Apr 2010 00:20:02 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:45422 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752854Ab0DOEUB (ORCPT ); Thu, 15 Apr 2010 00:20:01 -0400 Received: from m4.gw.fujitsu.co.jp ([10.0.50.74]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o3F4Jx6i000930 for (envelope-from seto.hidetoshi@jp.fujitsu.com); Thu, 15 Apr 2010 13:20:00 +0900 Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id C82A445DE6E for ; Thu, 15 Apr 2010 13:19:59 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id A02B245DE60 for ; Thu, 15 Apr 2010 13:19:59 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 82ACA1DB803A for ; Thu, 15 Apr 2010 13:19:59 +0900 (JST) Received: from ml14.s.css.fujitsu.com (ml14.s.css.fujitsu.com [10.249.87.104]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 26ADA1DB803E for ; Thu, 15 Apr 2010 13:19:56 +0900 (JST) Received: from ml14.css.fujitsu.com (ml14 [127.0.0.1]) by ml14.s.css.fujitsu.com (Postfix) with ESMTP id 01E729F6773; Thu, 15 Apr 2010 13:19:56 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.141]) by ml14.s.css.fujitsu.com (Postfix) with ESMTP id 592F59F676F; Thu, 15 Apr 2010 13:19:55 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from FMVDA2A041[10.124.100.141] by FMVDA2A041 (FujitsuOutboundMailChecker v1.3.1/9992[10.124.100.141]); Thu, 15 Apr 2010 13:19:53 +0900 (JST) Message-ID: <4BC693E4.2030505@jp.fujitsu.com> Date: Thu, 15 Apr 2010 13:19:48 +0900 From: Hidetoshi Seto User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: linux-pci@vger.kernel.org CC: Jesse Barnes , Kenji Kaneshige Subject: [PATCH 14/18] aerdrv: remove is_downstream References: <4BC690E8.307@jp.fujitsu.com> In-Reply-To: <4BC690E8.307@jp.fujitsu.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Apr 2010 04:20:06 +0000 (UTC) diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 9dcd3ae..8d458a0 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, struct find_aer_service_data { struct pcie_port_service_driver *aer_driver; - int is_downstream; }; static int find_aer_service_iter(struct device *device, void *data) { - struct device_driver *driver; struct pcie_port_service_driver *service_driver; struct find_aer_service_data *result; result = (struct find_aer_service_data *) data; - if (device->bus == &pcie_port_bus_type) { - struct pcie_device *pcie = to_pcie_device(device); - - if (pcie->port->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) - result->is_downstream = 1; - - driver = device->driver; - if (driver) { - service_driver = to_service_driver(driver); - if (service_driver->service == PCIE_PORT_SERVICE_AER) { - result->aer_driver = service_driver; - return 1; - } + if (device->bus == &pcie_port_bus_type && device->driver) { + service_driver = to_service_driver(device->driver); + if (service_driver->service == PCIE_PORT_SERVICE_AER) { + result->aer_driver = service_driver; + return 1; } } @@ -424,7 +414,6 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev, else udev = dev->bus->self; - data.is_downstream = 0; data.aer_driver = NULL; find_aer_service(udev, &data); @@ -433,22 +422,24 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev, * If it hasn't the aer driver, use the root port's */ if (!data.aer_driver || !data.aer_driver->reset_link) { - if (data.is_downstream && + if (udev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM && aerdev->device.driver && to_service_driver(aerdev->device.driver)->reset_link) { data.aer_driver = to_service_driver(aerdev->device.driver); } else { - dev_printk(KERN_DEBUG, &dev->dev, "no link-reset " - "support\n"); + dev_printk(KERN_DEBUG, &dev->dev, + "no link-reset support at upstream device %s\n", + pci_name(udev)); return PCI_ERS_RESULT_DISCONNECT; } } status = data.aer_driver->reset_link(udev); if (status != PCI_ERS_RESULT_RECOVERED) { - dev_printk(KERN_DEBUG, &dev->dev, "link reset at upstream " - "device %s failed\n", pci_name(udev)); + dev_printk(KERN_DEBUG, &dev->dev, + "link reset at upstream device %s failed\n", + pci_name(udev)); return PCI_ERS_RESULT_DISCONNECT; }