From patchwork Wed May 9 19:03:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 10390647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B02EE60153 for ; Wed, 9 May 2018 19:04:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ECAC28620 for ; Wed, 9 May 2018 19:04:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9370C28643; Wed, 9 May 2018 19:04:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 24BC628620 for ; Wed, 9 May 2018 19:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zzqwpQhJ9jYzKfLPvChx1o4eluzIeJXWoFEeWhGiO8Y=; b=ki0Hq9+DBbKxug qnxbO7Qr9CQJDW4cfrUgBxQVniJMTELr6SbqcEUbOre0Ze5JFbq8WoVdD2WlWXBFSP/0oASZsvOz0 NZNXlF9hRyj8+qWmAMh3DhKfWB1e6uTg4la/F3J2x0mpYuhkysZyCUyHGIBSGD4xx3X/RmpyuWwn3 W3d7OdNibKLpa+s+FTlzsrsOViM5XtkJq0ko0OVVlMQDUSpFKGHZUkQlIfCRwQ1I+4C6eIhMxYOSN HRE3/nnHUsH/sgvPUnk1D/oKfgvXntZDBGFq2TyK85jcKvePM0VAK7uw5nxLGKk17v3Fd9q2B0ags 3RHSTk+W6W/bjueiM1OA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGUNe-0008AA-Jz; Wed, 09 May 2018 19:04:02 +0000 Received: from goliath.siemens.de ([192.35.17.28]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGUNZ-0007xt-ST for linux-arm-kernel@lists.infradead.org; Wed, 09 May 2018 19:04:00 +0000 Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id w49J3Sr6017638 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 May 2018 21:03:29 +0200 Received: from [139.22.36.163] ([139.22.36.163]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id w49J3RvH025649; Wed, 9 May 2018 21:03:27 +0200 Subject: [PATCH v3 08/10] PCI: Remove of_pci_get_host_bridge_resources() To: Bjorn Helgaas , Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org References: <20180502123923.GA10783@infradead.org> <20180508132930.GL161390@bhelgaas-glaptop.roam.corp.google.com> From: Jan Kiszka Message-ID: <49036380-5962-2db2-aa34-d37ea47eef1d@siemens.com> Date: Wed, 9 May 2018 21:03:27 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <20180508132930.GL161390@bhelgaas-glaptop.roam.corp.google.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180509_120358_275001_2B7E4F32 X-CRM114-Status: GOOD ( 17.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christoph Hellwig , Bjorn Helgaas , linux-pci@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There are no in-tree users remaining, all are converted to the managed variant. And it is unlikely that any out-of-tree user got the resource management right as well. So remove the interface. Signed-off-by: Jan Kiszka --- This replaces "PCI: Deprecate of_pci_get_host_bridge_resources()" from the round v2. drivers/pci/of.c | 88 +++++++++++++------------------------------------- include/linux/of_pci.h | 10 ------ 2 files changed, 22 insertions(+), 76 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 5a88d46a41b7..38469ffd1d7e 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -243,11 +243,29 @@ void of_pci_check_probe_only(void) EXPORT_SYMBOL_GPL(of_pci_check_probe_only); #if defined(CONFIG_OF_ADDRESS) -static int __of_pci_get_host_bridge_resources(struct device *dev, - struct device_node *dev_node, +/** + * devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI + * host bridge resources from DT + * @dev: host bridge device + * @busno: bus number associated with the bridge root bus + * @bus_max: maximum number of buses for this bridge + * @resources: list where the range of resources will be added after DT parsing + * @io_base: pointer to a variable that will contain on return the physical + * address for the start of the I/O range. Can be NULL if the caller doesn't + * expect I/O ranges to be present in the device tree. + * + * This function will parse the "ranges" property of a PCI host bridge device + * node and setup the resource mapping based on its content. It is expected + * that the property conforms with the Power ePAPR document. + * + * It returns zero if the range parsing has been successful or a standard error + * value if it failed. + */ +int devm_of_pci_get_host_bridge_resources(struct device *dev, unsigned char busno, unsigned char bus_max, struct list_head *resources, resource_size_t *io_base) { + struct device_node *dev_node = dev->of_node; struct resource_entry *window; struct resource *res; struct resource *bus_range; @@ -259,10 +277,7 @@ static int __of_pci_get_host_bridge_resources(struct device *dev, if (io_base) *io_base = (resource_size_t)OF_BAD_ADDR; - if (dev) - bus_range = devm_kzalloc(dev,sizeof(*bus_range), GFP_KERNEL); - else - bus_range = kzalloc(sizeof(*bus_range), GFP_KERNEL); + bus_range = devm_kzalloc(dev,sizeof(*bus_range), GFP_KERNEL); if (!bus_range) return -ENOMEM; @@ -306,11 +321,7 @@ static int __of_pci_get_host_bridge_resources(struct device *dev, if (range.cpu_addr == OF_BAD_ADDR || range.size == 0) continue; - if (dev) - res = devm_kzalloc(dev, sizeof(struct resource), - GFP_KERNEL); - else - res = kzalloc(sizeof(struct resource), GFP_KERNEL); + res = devm_kzalloc(dev, sizeof(struct resource), GFP_KERNEL); if (!res) { err = -ENOMEM; goto parse_failed; @@ -350,62 +361,7 @@ static int __of_pci_get_host_bridge_resources(struct device *dev, pci_free_resource_list(resources); return err; } - -/** - * of_pci_get_host_bridge_resources() - Parse PCI host bridge resources from DT - * @dev_node: device node of the host bridge having the range property - * @busno: bus number associated with the bridge root bus - * @bus_max: maximum number of buses for this bridge - * @resources: list where the range of resources will be added after DT parsing - * @io_base: pointer to a variable that will contain on return the physical - * address for the start of the I/O range. Can be NULL if the caller doesn't - * expect I/O ranges to be present in the device tree. - * - * It is the caller's job to free the @resources list. - * - * This function will parse the "ranges" property of a PCI host bridge device - * node and setup the resource mapping based on its content. It is expected - * that the property conforms with the Power ePAPR document. - * - * It returns zero if the range parsing has been successful or a standard error - * value if it failed. - */ -int of_pci_get_host_bridge_resources(struct device_node *dev_node, - unsigned char busno, unsigned char bus_max, - struct list_head *resources, resource_size_t *io_base) -{ - return __of_pci_get_host_bridge_resources(NULL, dev_node, busno, - bus_max, resources, io_base); -} -EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources); - -/** - * of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI host - * bridge resources from DT - * @dev: host bridge device - * @busno: bus number associated with the bridge root bus - * @bus_max: maximum number of buses for this bridge - * @resources: list where the range of resources will be added after DT parsing - * @io_base: pointer to a variable that will contain on return the physical - * address for the start of the I/O range. Can be NULL if the caller doesn't - * expect I/O ranges to be present in the device tree. - * - * This function will parse the "ranges" property of a PCI host bridge device - * node and setup the resource mapping based on its content. It is expected - * that the property conforms with the Power ePAPR document. - * - * It returns zero if the range parsing has been successful or a standard error - * value if it failed. - */ -int devm_of_pci_get_host_bridge_resources(struct device *dev, - unsigned char busno, unsigned char bus_max, - struct list_head *resources, resource_size_t *io_base) -{ - return __of_pci_get_host_bridge_resources(dev, dev->of_node, busno, - bus_max, resources, io_base); -} EXPORT_SYMBOL_GPL(devm_of_pci_get_host_bridge_resources); - #endif /* CONFIG_OF_ADDRESS */ /** diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 08b8f02426a5..fa4463a52900 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -71,20 +71,10 @@ of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) #endif #if defined(CONFIG_OF_ADDRESS) -int of_pci_get_host_bridge_resources(struct device_node *dev_node, - unsigned char busno, unsigned char bus_max, - struct list_head *resources, resource_size_t *io_base); int devm_of_pci_get_host_bridge_resources(struct device *dev, unsigned char busno, unsigned char bus_max, struct list_head *resources, resource_size_t *io_base); #else -static inline int of_pci_get_host_bridge_resources(struct device_node *dev_node, - unsigned char busno, unsigned char bus_max, - struct list_head *resources, resource_size_t *io_base) -{ - return -EINVAL; -} - static inline int devm_of_pci_get_host_bridge_resources(struct device *dev, unsigned char busno, unsigned char bus_max, struct list_head *resources, resource_size_t *io_base)