From patchwork Thu Apr 15 04:14:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hidetoshi Seto X-Patchwork-Id: 92643 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 o3F4EkYx014407 for ; Thu, 15 Apr 2010 04:14:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349Ab0DOEOp (ORCPT ); Thu, 15 Apr 2010 00:14:45 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:39975 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753315Ab0DOEOp (ORCPT ); Thu, 15 Apr 2010 00:14:45 -0400 Received: from m4.gw.fujitsu.co.jp ([10.0.50.74]) by fgwmail7.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o3F4Ehq8008462 for (envelope-from seto.hidetoshi@jp.fujitsu.com); Thu, 15 Apr 2010 13:14:44 +0900 Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 869AE45DE6E for ; Thu, 15 Apr 2010 13:14:43 +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 66A1145DE60 for ; Thu, 15 Apr 2010 13:14:43 +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 43ADC1DB8040 for ; Thu, 15 Apr 2010 13:14:43 +0900 (JST) Received: from ml13.s.css.fujitsu.com (ml13.s.css.fujitsu.com [10.249.87.103]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 02CF21DB803A for ; Thu, 15 Apr 2010 13:14:43 +0900 (JST) Received: from ml13.css.fujitsu.com (ml13 [127.0.0.1]) by ml13.s.css.fujitsu.com (Postfix) with ESMTP id 6C68BFD0005; Thu, 15 Apr 2010 13:14:42 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.141]) by ml13.s.css.fujitsu.com (Postfix) with ESMTP id 52974FD0017; Thu, 15 Apr 2010 13:14:33 +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:14:31 +0900 (JST) Message-ID: <4BC69299.7040001@jp.fujitsu.com> Date: Thu, 15 Apr 2010 13:14:17 +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 08/18] aerdrv: rework add_error_device 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:14:46 +0000 (UTC) diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index f8ffa47..f5eb69f 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -99,18 +99,21 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) } EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); +/** + * add_error_device - list device to be handled + * @e_info: pointer to error info + * @dev: pointer to pci_dev to be added + */ static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev) { if (e_info->error_dev_num < AER_MAX_MULTI_ERR_DEVICES) { e_info->dev[e_info->error_dev_num] = dev; e_info->error_dev_num++; - return 1; + return 0; } - - return 0; + return -ENOSPC; } - #define PCI_BUS(x) (((x) >> 8) & 0xff) /** @@ -183,7 +186,12 @@ static int find_device_iter(struct pci_dev *dev, void *data) struct aer_err_info *e_info = (struct aer_err_info *)data; if (is_error_source(dev, e_info)) { - add_error_device(e_info, dev); + /* List this device */ + if (add_error_device(e_info, dev)) { + /* We cannot handle more... Stop iteration */ + /* TODO: Should print error message here? */ + return 1; + } /* If there is only a single error, stop iteration */ if (!e_info->multi_error_valid)