From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753319AbbCWMwF (ORCPT ); Mon, 23 Mar 2015 08:52:05 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:54045 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752659AbbCWMoQ (ORCPT ); Mon, 23 Mar 2015 08:44:16 -0400 From: Yijing Wang 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 , "Yijing Wang" Subject: [PATCH v7 13/31] PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge() Date: Mon, 23 Mar 2015 20:40:39 +0800 Message-ID: <1427114457-16687-14-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> References: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move pcibios_root_bridge_prepare() to pci_create_host_bridge(). Signed-off-by: Yijing Wang --- drivers/pci/host-bridge.c | 16 +++++++++++++--- drivers/pci/probe.c | 3 --- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index b0ed8da..87c4fc5 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -92,9 +92,7 @@ struct pci_host_bridge *pci_create_host_bridge( pr_warn("pci host bridge pci%04x:%02x exist\n", host->domain, bus); mutex_unlock(&pci_host_mutex); - pci_free_resource_list(&host->windows); - kfree(host); - return NULL; + goto free_res; } } list_add_tail(&host->list, &pci_host_bridge_list); @@ -105,6 +103,10 @@ struct pci_host_bridge *pci_create_host_bridge( dev_set_name(&host->dev, "pci%04x:%02x", host->domain, bus); + error = pcibios_root_bridge_prepare(host); + if (error) + goto list_del; + error = device_register(&host->dev); if (error) { put_device(&host->dev); @@ -112,6 +114,14 @@ struct pci_host_bridge *pci_create_host_bridge( } return host; +list_del: + mutex_lock(&pci_host_mutex); + list_del(&host->list); + mutex_unlock(&pci_host_mutex); +free_res: + pci_free_resource_list(&host->windows); + kfree(host); + return NULL; } void pci_free_host_bridge(struct pci_host_bridge *host) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 418a426..ee17d9a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1893,9 +1893,6 @@ static struct pci_bus *__pci_create_root_bus( bridge->bus = b; b->bridge = get_device(&bridge->dev); - error = pcibios_root_bridge_prepare(bridge); - if (error) - goto put_dev; pcibios_set_root_bus_speed(bridge); device_enable_async_suspend(b->bridge); -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com ([119.145.14.65]:54045 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752659AbbCWMoQ (ORCPT ); Mon, 23 Mar 2015 08:44:16 -0400 From: Yijing Wang 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 , "Yijing Wang" Subject: [PATCH v7 13/31] PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge() Date: Mon, 23 Mar 2015 20:40:39 +0800 Message-ID: <1427114457-16687-14-git-send-email-wangyijing@huawei.com> In-Reply-To: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> References: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-pci-owner@vger.kernel.org List-ID: Move pcibios_root_bridge_prepare() to pci_create_host_bridge(). Signed-off-by: Yijing Wang --- drivers/pci/host-bridge.c | 16 +++++++++++++--- drivers/pci/probe.c | 3 --- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index b0ed8da..87c4fc5 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -92,9 +92,7 @@ struct pci_host_bridge *pci_create_host_bridge( pr_warn("pci host bridge pci%04x:%02x exist\n", host->domain, bus); mutex_unlock(&pci_host_mutex); - pci_free_resource_list(&host->windows); - kfree(host); - return NULL; + goto free_res; } } list_add_tail(&host->list, &pci_host_bridge_list); @@ -105,6 +103,10 @@ struct pci_host_bridge *pci_create_host_bridge( dev_set_name(&host->dev, "pci%04x:%02x", host->domain, bus); + error = pcibios_root_bridge_prepare(host); + if (error) + goto list_del; + error = device_register(&host->dev); if (error) { put_device(&host->dev); @@ -112,6 +114,14 @@ struct pci_host_bridge *pci_create_host_bridge( } return host; +list_del: + mutex_lock(&pci_host_mutex); + list_del(&host->list); + mutex_unlock(&pci_host_mutex); +free_res: + pci_free_resource_list(&host->windows); + kfree(host); + return NULL; } void pci_free_host_bridge(struct pci_host_bridge *host) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 418a426..ee17d9a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1893,9 +1893,6 @@ static struct pci_bus *__pci_create_root_bus( bridge->bus = b; b->bridge = get_device(&bridge->dev); - error = pcibios_root_bridge_prepare(bridge); - if (error) - goto put_dev; pcibios_set_root_bus_speed(bridge); device_enable_async_suspend(b->bridge); -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: wangyijing@huawei.com (Yijing Wang) Date: Mon, 23 Mar 2015 20:40:39 +0800 Subject: [PATCH v7 13/31] PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge() In-Reply-To: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> References: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> Message-ID: <1427114457-16687-14-git-send-email-wangyijing@huawei.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Move pcibios_root_bridge_prepare() to pci_create_host_bridge(). Signed-off-by: Yijing Wang --- drivers/pci/host-bridge.c | 16 +++++++++++++--- drivers/pci/probe.c | 3 --- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index b0ed8da..87c4fc5 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -92,9 +92,7 @@ struct pci_host_bridge *pci_create_host_bridge( pr_warn("pci host bridge pci%04x:%02x exist\n", host->domain, bus); mutex_unlock(&pci_host_mutex); - pci_free_resource_list(&host->windows); - kfree(host); - return NULL; + goto free_res; } } list_add_tail(&host->list, &pci_host_bridge_list); @@ -105,6 +103,10 @@ struct pci_host_bridge *pci_create_host_bridge( dev_set_name(&host->dev, "pci%04x:%02x", host->domain, bus); + error = pcibios_root_bridge_prepare(host); + if (error) + goto list_del; + error = device_register(&host->dev); if (error) { put_device(&host->dev); @@ -112,6 +114,14 @@ struct pci_host_bridge *pci_create_host_bridge( } return host; +list_del: + mutex_lock(&pci_host_mutex); + list_del(&host->list); + mutex_unlock(&pci_host_mutex); +free_res: + pci_free_resource_list(&host->windows); + kfree(host); + return NULL; } void pci_free_host_bridge(struct pci_host_bridge *host) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 418a426..ee17d9a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1893,9 +1893,6 @@ static struct pci_bus *__pci_create_root_bus( bridge->bus = b; b->bridge = get_device(&bridge->dev); - error = pcibios_root_bridge_prepare(bridge); - if (error) - goto put_dev; pcibios_set_root_bus_speed(bridge); device_enable_async_suspend(b->bridge); -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yijing Wang Date: Mon, 23 Mar 2015 12:40:39 +0000 Subject: [PATCH v7 13/31] PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge() Message-Id: <1427114457-16687-14-git-send-email-wangyijing@huawei.com> List-Id: References: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> In-Reply-To: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bjorn Helgaas Cc: Jiang Liu , linux-pci@vger.kernel.org, Yinghai Lu , linux-kernel@vger.kernel.org, Marc Zyngier , linux-arm-kernel@lists.infradead.org, Russell King , x86@kernel.org, Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , linux-ia64@vger.kernel.org, "David S. Miller" , Guan Xuetao , linux-alpha@vger.kernel.org, linux-m68k@vger.kernel.org, Liviu Dudau , Arnd Bergmann , Geert Uytterhoeven , Yijing Wang Move pcibios_root_bridge_prepare() to pci_create_host_bridge(). Signed-off-by: Yijing Wang --- drivers/pci/host-bridge.c | 16 +++++++++++++--- drivers/pci/probe.c | 3 --- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index b0ed8da..87c4fc5 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -92,9 +92,7 @@ struct pci_host_bridge *pci_create_host_bridge( pr_warn("pci host bridge pci%04x:%02x exist\n", host->domain, bus); mutex_unlock(&pci_host_mutex); - pci_free_resource_list(&host->windows); - kfree(host); - return NULL; + goto free_res; } } list_add_tail(&host->list, &pci_host_bridge_list); @@ -105,6 +103,10 @@ struct pci_host_bridge *pci_create_host_bridge( dev_set_name(&host->dev, "pci%04x:%02x", host->domain, bus); + error = pcibios_root_bridge_prepare(host); + if (error) + goto list_del; + error = device_register(&host->dev); if (error) { put_device(&host->dev); @@ -112,6 +114,14 @@ struct pci_host_bridge *pci_create_host_bridge( } return host; +list_del: + mutex_lock(&pci_host_mutex); + list_del(&host->list); + mutex_unlock(&pci_host_mutex); +free_res: + pci_free_resource_list(&host->windows); + kfree(host); + return NULL; } void pci_free_host_bridge(struct pci_host_bridge *host) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 418a426..ee17d9a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1893,9 +1893,6 @@ static struct pci_bus *__pci_create_root_bus( bridge->bus = b; b->bridge = get_device(&bridge->dev); - error = pcibios_root_bridge_prepare(bridge); - if (error) - goto put_dev; pcibios_set_root_bus_speed(bridge); device_enable_async_suspend(b->bridge); -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yijing Wang Subject: [PATCH v7 13/31] PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge() Date: Mon, 23 Mar 2015 20:40:39 +0800 Message-ID: <1427114457-16687-14-git-send-email-wangyijing@huawei.com> References: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1427114457-16687-1-git-send-email-wangyijing@huawei.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Bjorn Helgaas Cc: Liviu Dudau , Rusty Russell , Russell King , Arnd Bergmann , Marc Zyngier , linux-pci@vger.kernel.org, x86@kernel.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, "David S. Miller" , linux-alpha@vger.kernel.org, Tony Luck , Geert Uytterhoeven , Benjamin Herrenschmidt , Yijing Wang , linux-ia64@vger.kernel.org, Thomas Gleixner , Guan Xuetao , Yinghai Lu , Jiang Liu , linux-arm-kernel@lists.infradead.org Move pcibios_root_bridge_prepare() to pci_create_host_bridge(). Signed-off-by: Yijing Wang --- drivers/pci/host-bridge.c | 16 +++++++++++++--- drivers/pci/probe.c | 3 --- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index b0ed8da..87c4fc5 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -92,9 +92,7 @@ struct pci_host_bridge *pci_create_host_bridge( pr_warn("pci host bridge pci%04x:%02x exist\n", host->domain, bus); mutex_unlock(&pci_host_mutex); - pci_free_resource_list(&host->windows); - kfree(host); - return NULL; + goto free_res; } } list_add_tail(&host->list, &pci_host_bridge_list); @@ -105,6 +103,10 @@ struct pci_host_bridge *pci_create_host_bridge( dev_set_name(&host->dev, "pci%04x:%02x", host->domain, bus); + error = pcibios_root_bridge_prepare(host); + if (error) + goto list_del; + error = device_register(&host->dev); if (error) { put_device(&host->dev); @@ -112,6 +114,14 @@ struct pci_host_bridge *pci_create_host_bridge( } return host; +list_del: + mutex_lock(&pci_host_mutex); + list_del(&host->list); + mutex_unlock(&pci_host_mutex); +free_res: + pci_free_resource_list(&host->windows); + kfree(host); + return NULL; } void pci_free_host_bridge(struct pci_host_bridge *host) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 418a426..ee17d9a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1893,9 +1893,6 @@ static struct pci_bus *__pci_create_root_bus( bridge->bus = b; b->bridge = get_device(&bridge->dev); - error = pcibios_root_bridge_prepare(bridge); - if (error) - goto put_dev; pcibios_set_root_bus_speed(bridge); device_enable_async_suspend(b->bridge); -- 1.7.1