From patchwork Fri Apr 17 20:15:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 18737 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 n3HKG7dA021304 for ; Fri, 17 Apr 2009 20:16:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752767AbZDQUQG (ORCPT ); Fri, 17 Apr 2009 16:16:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752930AbZDQUQG (ORCPT ); Fri, 17 Apr 2009 16:16:06 -0400 Received: from hera.kernel.org ([140.211.167.34]:51131 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752767AbZDQUQF (ORCPT ); Fri, 17 Apr 2009 16:16:05 -0400 Received: from [10.6.76.26] (sca-ea-fw-1.Sun.COM [192.18.43.225]) (authenticated bits=0) by hera.kernel.org (8.14.2/8.13.8) with ESMTP id n3HKFe1O017809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Apr 2009 20:15:44 GMT Message-ID: <49E8E368.5010804@kernel.org> Date: Fri, 17 Apr 2009 13:15:36 -0700 From: Yinghai Lu User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: Matthew Wilcox , Jesse Barnes CC: Ingo Molnar , Thomas Gleixner , linux-pci@vger.kernel.org, Kenji Kaneshige Subject: Re: [PATCH 1/2] pci: don't assign non root buses References: <20090416193110.GF1926@parisc-linux.org> <20090417001248.GA29630@elte.hu> <49E7FF48.1060509@kernel.org> <20090417155857.GH1926@parisc-linux.org> <49E8C0DC.5070108@kernel.org> In-Reply-To: <49E8C0DC.5070108@kernel.org> X-Virus-Scanned: ClamAV 0.93.3/9252/Fri Apr 17 18:21:29 2009 on hera.kernel.org X-Virus-Status: Clean Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Yinghai Lu wrote: > Matthew Wilcox wrote: >> On Thu, Apr 16, 2009 at 09:02:16PM -0700, Yinghai Lu wrote: >>> Impact: cleanup >>> >>> it will be assigned late pci_scan_child_bus/pcibios_fixup_bus >> Seems to me they're assigned in pci_alloc_child_bus(), not in >> pci_scan_child_bus(). Also, pcibios_fixup_bus may adjust them, but it >> doesn't assign them. > > right. > >> This is all moot as: >> >>> b->number = b->secondary = bus; >>> - b->resource[0] = &ioport_resource; >>> - b->resource[1] = &iomem_resource; >>> + >>> + /* don't need assign those for non root buses */ >>> + if (!parent) { >>> + b->resource[0] = &ioport_resource; >>> + b->resource[1] = &iomem_resource; >>> + } >>> >> parent != NULL does *NOT* mean non-root bus. Get your head out of >> x86 and realise we have architectures which have pci root busses which >> have parents. >> > > interesting. > > how does lspci -tv look like ? can you fix pci_is_root_bus? YH commit 79af72d716cf1bb13b175429cf181a6c4d063ee8 Author: Kenji Kaneshige Date: Fri Mar 20 14:55:55 2009 -0600 PCI: pci_is_root_bus helper 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 Signed-off-by: Jesse Barnes --- 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 1216843..50d9438 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -357,6 +357,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) {