From patchwork Thu Aug 16 12:12:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 1331121 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A0BCC40210 for ; Thu, 16 Aug 2012 12:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754107Ab2HPMNR (ORCPT ); Thu, 16 Aug 2012 08:13:17 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:29551 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855Ab2HPMNQ (ORCPT ); Thu, 16 Aug 2012 08:13:16 -0400 Received: from 172.24.2.119 (EHLO szxeml201-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id ANP47022; Thu, 16 Aug 2012 20:13:14 +0800 (CST) Received: from SZXEML405-HUB.china.huawei.com (10.82.67.60) by szxeml201-edg.china.huawei.com (172.24.2.39) with Microsoft SMTP Server (TLS) id 14.1.323.3; Thu, 16 Aug 2012 20:13:07 +0800 Received: from localhost (10.135.76.84) by szxeml405-hub.china.huawei.com (10.82.67.60) with Microsoft SMTP Server id 14.1.323.3; Thu, 16 Aug 2012 20:13:01 +0800 From: Yijing Wang To: Bjorn Helgaas , CC: Hanjun Guo , Jiang Liu , Yinghai Lu , Yijing Wang Subject: [PATCH 3/3] PCI, acpiphp: Use res->flags to determine whether the resouce is valid Date: Thu, 16 Aug 2012 20:12:22 +0800 Message-ID: <1345119142-5896-3-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.11.msysgit.1 In-Reply-To: <1345119142-5896-1-git-send-email-wangyijing@huawei.com> References: <1345119142-5896-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.76.84] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When we hot plug pci devices, system will allocate resources to these new add devices, pci_bus_assign_resources() will be called.If the pci devices was assigned resource fail, the resource struct will reset to zero.So I think use res->flags here to determine whether the resource is valid is reliable. Signed-off-by: Yijing Wang --- drivers/pci/hotplug/acpiphp_glue.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 7bbd6bf..2161902 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -1084,13 +1084,11 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus) { struct pci_dev *dev, *tmp; int i; - unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { for (i=0; iresource[i]; - if ((res->flags & type_mask) && !res->start && - res->end) { + if (!res->flags) { /* Could not assign a required resources * for this device, remove it */ pci_stop_and_remove_bus_device(dev);