From patchwork Fri Mar 20 20:55:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chiang X-Patchwork-Id: 13374 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2KKufK4001652 for ; Fri, 20 Mar 2009 20:56:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756595AbZCTUz7 (ORCPT ); Fri, 20 Mar 2009 16:55:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756317AbZCTUz7 (ORCPT ); Fri, 20 Mar 2009 16:55:59 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:25353 "EHLO g4t0017.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757570AbZCTUz6 (ORCPT ); Fri, 20 Mar 2009 16:55:58 -0400 Received: from smtp1.fc.hp.com (smtp.cnd.hp.com [15.15.136.127]) by g4t0017.houston.hp.com (Postfix) with ESMTP id E928D38046; Fri, 20 Mar 2009 20:55:55 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id D3959247C4A; Fri, 20 Mar 2009 20:27:16 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 7B8DA2615B; Fri, 20 Mar 2009 14:55:55 -0600 (MDT) From: Alex Chiang Subject: [PATCH v5 01/13] PCI: pci_is_root_bus helper To: jbarnes@virtuousgeek.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kenji Kaneshige , Alex Chiang Date: Fri, 20 Mar 2009 14:55:55 -0600 Message-ID: <20090320205555.12275.10712.stgit@bob.kio> In-Reply-To: <20090320204327.12275.43010.stgit@bob.kio> References: <20090320204327.12275.43010.stgit@bob.kio> User-Agent: StGIT/0.14.3.215.gff3d MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Kenji Kaneshige Introduce pci_is_root_bus helper function. This will help make code more consistent, as well as prevent incorrect assumptions (such as pci_bus->self == NULL on a root bus, which is not always true). Signed-off-by: Kenji Kaneshige Signed-off-by: Alex Chiang --- include/linux/pci.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/pci.h b/include/linux/pci.h index 1f6c5dd..72ccf15 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -341,6 +341,15 @@ struct pci_bus { #define pci_bus_b(n) list_entry(n, struct pci_bus, node) #define to_pci_bus(n) container_of(n, struct pci_bus, dev) +/* + * Returns true if the pci bus is root (behind host-pci bridge), + * false otherwise + */ +static inline bool pci_is_root_bus(struct pci_bus *pbus) +{ + return !(pbus->parent); +} + #ifdef CONFIG_PCI_MSI static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) {