From patchwork Fri Jun 21 16:12:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2763481 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F42109F756 for ; Fri, 21 Jun 2013 16:14:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1346B202B8 for ; Fri, 21 Jun 2013 16:14:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1433A202B4 for ; Fri, 21 Jun 2013 16:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423203Ab3FUQNH (ORCPT ); Fri, 21 Jun 2013 12:13:07 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:33228 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161564Ab3FUQNG (ORCPT ); Fri, 21 Jun 2013 12:13:06 -0400 Received: by mail-pb0-f49.google.com with SMTP id jt11so7937139pbb.22 for ; Fri, 21 Jun 2013 09:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=qH5qsnZnmAPiEYsXjYowqxL3m8lV6dNhpWHXZHOYMhk=; b=SIXU3YAp1SfhvxSKVgbUaIIzKgiZcBLH533OK3JWQCbSkEZT/ttEpxPXOG1/obd60F Nadb6Yruuaz0UqKaKyhjjI3bhbQ+K24f8fkk0Uzqg+v5Pr3u+L0j16kRlvHsYn6R+8El VLMcvOfEpQ8rhBeNDRq8HFD0mOYYoIub30qdNJDqjtEpxOK0CkDPZN6w/7/AT1YnUbyj h34UuYUTGClSDsnCxHMGcR5QqG/qAY5JkD9BuZMpj5430tQEUIsRIjiWv6rKRiXHSNS1 G+IaL7f9tjh1OopDmSDNeUq/WNRBcbU0J4RGRiwH7KMexDV/8mSLXBT877fhmAJg7kmb 7O6g== X-Received: by 10.68.143.5 with SMTP id sa5mr13051182pbb.106.1371831186010; Fri, 21 Jun 2013 09:13:06 -0700 (PDT) Received: from localhost.localdomain ([120.196.98.106]) by mx.google.com with ESMTPSA id fm2sm6257244pab.13.2013.06.21.09.13.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Jun 2013 09:13:05 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Konrad Rzeszutek Wilk , Jeremy Fitzhardinge Cc: liuj97@gmail.com, Jiang Liu , Yijing Wang , xen-devel@lists.xensource.com, virtualization@lists.linux-foundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] PCI: export three functions to support modular host bridge driver Date: Sat, 22 Jun 2013 00:12:46 +0800 Message-Id: <1371831169-17291-2-git-send-email-liuj97@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1371831169-17291-1-git-send-email-liuj97@gmail.com> References: <1371831169-17291-1-git-send-email-liuj97@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jiang Liu The xen-pcifront host bridge driver could be built as a module, so export pci_create_root_bus(), pci_stop_and_remove_root_bus() and pci_set_host_bridge_release() to support modular host bridge driver. It's a preparation for coming xen-pcifront refinement. Signed-off-by: Jiang Liu Cc: Konrad Rzeszutek Wilk Cc: Jeremy Fitzhardinge Cc: xen-devel@lists.xensource.com Cc: virtualization@lists.linux-foundation.org Cc: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/host-bridge.c | 1 + drivers/pci/probe.c | 1 + drivers/pci/remove.c | 7 +++++++ include/linux/pci.h | 1 + 4 files changed, 10 insertions(+) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index a68dc61..6e390a6 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -34,6 +34,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge, bridge->release_fn = release_fn; bridge->release_data = release_data; } +EXPORT_SYMBOL(pci_set_host_bridge_release); static bool resource_contains(struct resource *res1, struct resource *res2) { diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 46ada5c..ed768d8 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1801,6 +1801,7 @@ err_out: kfree(b); return NULL; } +EXPORT_SYMBOL(pci_create_root_bus); int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max) { diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 8fc54b7..f328668 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -147,3 +147,10 @@ void pci_remove_root_bus(struct pci_bus *bus) /* remove the host bridge */ put_device(&host_bridge->dev); } + +void pci_stop_and_remove_root_bus(struct pci_bus *bus) +{ + pci_stop_root_bus(bus); + pci_remove_root_bus(bus); +} +EXPORT_SYMBOL(pci_stop_and_remove_root_bus); diff --git a/include/linux/pci.h b/include/linux/pci.h index 0fd1f15..f1229c7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -757,6 +757,7 @@ void pci_remove_bus(struct pci_bus *b); void pci_stop_and_remove_bus_device(struct pci_dev *dev); void pci_stop_root_bus(struct pci_bus *bus); void pci_remove_root_bus(struct pci_bus *bus); +void pci_stop_and_remove_root_bus(struct pci_bus *bus); void pci_setup_cardbus(struct pci_bus *bus); void pci_sort_breadthfirst(void); #define dev_is_pci(d) ((d)->bus == &pci_bus_type)