From patchwork Tue Sep 25 17:37:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 1506261 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 2A7FDDFE80 for ; Tue, 25 Sep 2012 17:37:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755101Ab2IYRhd (ORCPT ); Tue, 25 Sep 2012 13:37:33 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:35300 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148Ab2IYRhc (ORCPT ); Tue, 25 Sep 2012 13:37:32 -0400 Received: by lbon3 with SMTP id n3so488150lbo.19 for ; Tue, 25 Sep 2012 10:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record; bh=1UM3yY3dkUWbe9mbMQHBQYjT64+ANgwtdcnd+4FhDAk=; b=X+NRQrtzqT5mupnCPlX68vx3uJ6LrulVPLLWTVvXkVoiPSYimKWVtEyKoVQSILrrvi MVMn04CYIWgkNDjM3h7aiWxD3jH9GdZY0LwlaZDx8sgBN8oUCm29XCncaDWLqj6wZlfu 16a7a/OfCTocdBILuRh4hIszjU9cjEDh2ZZK4RxbeLcM/PPb+7zBSh14vDL6ZjKnWPHM CUFZURgDRzqFP/qbyBek93Jj+LvWpEtf9MZn6Cw/G3KqoVlmUqWsOpaNXvU3lH9vJbP/ hPcEfUZqxBjM08/jAUoY9YyqLdeC7dTFBLTW0d1kfNyeFdaFp38cUmZ2uZNvyzu33Kh3 HNsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=1UM3yY3dkUWbe9mbMQHBQYjT64+ANgwtdcnd+4FhDAk=; b=cxxAU/jHBfuQCWVncHdbTd8maa9eCmhPc9lRA3LTLvesmnPCR7oqf8u8dj3hx8vNrl C61lqA4BL7KpovYByBZUNw6p4p0g3sGk6zjxAzop5kuiM2J+OimVvWSWuz9WnBXzlo9f SAk2QLCIuZuHuDc5mjY5nIW+R8+zgNYowabZf4nC4GwfmMXuSZIr9L8iaf5lIQfR4qKl Fu72vv/iEhTFLfQGutO668UoZvrVdaFhq1WvTdAoeNgYNpAfe8EsJJe1It/fRxTAKNuy YdUoIpmXXCWhoOR/K6vhM4rX8EbMunJxwDMuUNLTg8pWOa2mqTHaijLTb5nN/1P/YaS2 koKg== Received: by 10.112.100.8 with SMTP id eu8mr5944207lbb.12.1348594651328; Tue, 25 Sep 2012 10:37:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.132.73 with HTTP; Tue, 25 Sep 2012 10:37:11 -0700 (PDT) In-Reply-To: References: <1348561590-28067-1-git-send-email-yinghai@kernel.org> From: Bjorn Helgaas Date: Tue, 25 Sep 2012 11:37:11 -0600 Message-ID: Subject: Re: [PATCH 00/29] PCI: use pci host bridge to loop pci root bus To: Yinghai Lu Cc: Len Brown , linux-pci@vger.kernel.org X-System-Of-Record: true X-Gm-Message-State: ALoCoQmgKNrcdaUElxrY3kNPBwvVVeV87G7mWvXadJx7V0YaVZQnC3UqCeYjoyeE3qr3FP6BrAI/HQqx0mz2gXZrZEndgArmV6uNGacIXKbWwoH2bmy+cPwiDjBRmevaKLj8F3Yz1Ig6c2aHiEklO71jeP38bzjpOojGh0jRmM4PKFHi9CH3tSqjTK7S9QiA8i0l4rO0t8Q7bJDzkwF+76IUsnWQmUTq3w== Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, Sep 25, 2012 at 10:29 AM, Yinghai Lu wrote: > On Tue, Sep 25, 2012 at 9:23 AM, Bjorn Helgaas wrote: >> On Tue, Sep 25, 2012 at 2:26 AM, Yinghai Lu wrote: >>> could remove pci_root_buses list. >>> > ... >>> PCI: Add dummy bus_type for pci_host_bridge > ... >>> PCI: Add for_each_pci_host_bridge() and pci_get_next_host_bridge >> >> I'm not thrilled about adding a new iterator for all host bridges. >> >> The iterator design pattern does not work for collections that can >> change over time. In this case, it looks like you're adding a safer >> way to iterate through all host bridges we know about at this time. >> But we still have the problem of the host bridge that's added >> tomorrow. >> >> I'd prefer a design where the PCI core provides an interface that >> means "call this function for every host bridge we know about now >> *and* for every one that's added in the future." > > yes, that is the point to add pci_root_bridge_bus_type. We can register > bus notifier on that. I guess I missed your point. In the patch below (20/29 from your series), you're still iterating through all the host bridges, so there would have to be something else to handle hot-added host bridges. Are you saying you plan future patches to change this again to something using a bus notifier? node = pbus->self->dev.of_node; --- 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 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -997,11 +997,13 @@ static void __devinit pci_bus_slot_names(struct device_node *node, static int __init of_pci_slot_init(void) { - struct pci_bus *pbus = NULL; + struct pci_host_bridge *host_bridge = NULL; + struct pci_bus *pbus; - while ((pbus = pci_find_next_bus(pbus)) != NULL) { + for_each_pci_host_bridge(host_bridge) { struct device_node *node; + pbus = hot_bridge->bus; if (pbus->self) { /* PCI->PCI bridge */