From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755597AbbCCImT (ORCPT ); Tue, 3 Mar 2015 03:42:19 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:19829 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755043AbbCCImQ (ORCPT ); Tue, 3 Mar 2015 03:42:16 -0500 Message-ID: <54F573D2.6010807@huawei.com> Date: Tue, 3 Mar 2015 16:41:54 +0800 From: Yijing Wang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Bjorn Helgaas CC: Jiang Liu , , Yinghai Lu , , Marc Zyngier , , Russell King , , Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , , "David S. Miller" , "Guan Xuetao" , , , Liviu Dudau , "Arnd Bergmann" , Geert Uytterhoeven Subject: Re: [PATCH v4 12/30] PCI: Introduce pci_host_bridge_ops to support host specific operations References: <1424938344-4017-1-git-send-email-wangyijing@huawei.com> <1424938344-4017-13-git-send-email-wangyijing@huawei.com> <20150303030301.GI11978@google.com> In-Reply-To: <20150303030301.GI11978@google.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.27.212] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.54F573E0.00BE,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: da448b11b5e7e91a2129f34e77a8a3dd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/3/3 11:03, Bjorn Helgaas wrote: > On Thu, Feb 26, 2015 at 04:12:06PM +0800, Yijing Wang wrote: >> Now we have weak functions like pcibios_root_bridge_prepare() >> to setup pci host bridge, We could introduce pci_host_bridge_ops >> which contain host bridge specific ops to setup pci_host_bridge. >> Then host bridge driver could add pci_host_bridge_ops hooks >> intead of weak function to setup pci_host_bridge. >> This patch add following pci_host_bridge_ops hooks: >> >> pci_host_bridge_ops { >> /* set root bus speed, some platform need this like powerpc */ >> void (*phb_set_root_bus_speed)(struct pci_host_bridge *host); >> /* setup pci_host_bridge before pci_host_bridge be added to driver core */ >> int (*phb_prepare)(struct pci_host_bridge *host); >> /* platform specific of scan hook to scan pci device */ >> void (*phb_of_scan_bus)(struct pci_host_bridge *); >> } >> We could easily extend it to support different host bridge >> specific operations. >> >> Signed-off-by: Yijing Wang >> ... > >> @@ -2050,10 +2052,13 @@ static struct pci_bus *__pci_scan_root_bus( >> pci_bus_insert_busn_res(b, b->number, 255); >> } >> >> - max = pci_scan_child_bus(b); >> - >> - if (!found) >> - pci_bus_update_busn_res_end(b, max); >> + if (host->ops && host->ops->phb_of_scan_bus) { >> + host->ops->phb_of_scan_bus(host); > > The important thing here is not the use of OF (Open Firmware/Device Tree), > is it? Why would we want "_of_" in the function name? I assume the intent > is that this host bridge op performs the same function as > pci_scan_child_bus(), so I think the op should be called "scan_bus". Yes, because now only OF code need the private scan_child_bus, so I named it phb_of_scan_bus(). I agree that rename it to scan_bus. > >> + } else { >> + max = pci_scan_child_bus(b); >> + if (!found) >> + pci_bus_update_busn_res_end(b, max); >> + } >> >> return b; >> } > > . > -- Thanks! Yijing