From patchwork Fri Mar 24 01:50:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 9642227 X-Patchwork-Delegate: bhelgaas@google.com 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 B753D602CA for ; Fri, 24 Mar 2017 01:51:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A66042848B for ; Fri, 24 Mar 2017 01:51:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 993D828474; Fri, 24 Mar 2017 01:51:06 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 431A328474 for ; Fri, 24 Mar 2017 01:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752607AbdCXBu4 (ORCPT ); Thu, 23 Mar 2017 21:50:56 -0400 Received: from regular1.263xmail.com ([211.150.99.134]:35521 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751923AbdCXBuz (ORCPT ); Thu, 23 Mar 2017 21:50:55 -0400 Received: from jeffy.chen?rock-chips.com (unknown [192.168.165.103]) by regular1.263xmail.com (Postfix) with ESMTP id A83C29136; Fri, 24 Mar 2017 09:50:47 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from smtp.263.net (sg-smtp01.263.net [54.255.195.220]) by smtp.263.net (Postfix) with ESMTP id 357DF3F6; Fri, 24 Mar 2017 09:50:46 +0800 (CST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 2B6E7DF2ED; Fri, 24 Mar 2017 09:50:46 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 31575N0TOB2; Fri, 24 Mar 2017 09:50:47 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Cc: robh@kernel.org, toshi.kani@hpe.com, shawn.lin@rock-chips.com, briannorris@chromium.org, dianders@chromium.org, bhelgaas@google.com, dtor@chromium.org, Jeffy Chen , linux-pci@vger.kernel.org Subject: [PATCH v3 1/2] PCI: return resource_entry in pci_add_resource helpers Date: Fri, 24 Mar 2017 09:50:40 +0800 Message-Id: <1490320241-9250-2-git-send-email-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490320241-9250-1-git-send-email-jeffy.chen@rock-chips.com> References: <1490320241-9250-1-git-send-email-jeffy.chen@rock-chips.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jeffy Chen --- Changes in v3: None Changes in v2: None drivers/pci/bus.c | 13 ++++++++----- include/linux/pci.h | 8 +++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index bc56cf1..36a1861 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -17,25 +17,28 @@ #include "pci.h" -void pci_add_resource_offset(struct list_head *resources, struct resource *res, - resource_size_t offset) +struct resource_entry *pci_add_resource_offset(struct list_head *resources, + struct resource *res, + resource_size_t offset) { struct resource_entry *entry; entry = resource_list_create_entry(res, 0); if (!entry) { printk(KERN_ERR "PCI: can't add host bridge window %pR\n", res); - return; + return NULL; } entry->offset = offset; resource_list_add_tail(entry, resources); + return entry; } EXPORT_SYMBOL(pci_add_resource_offset); -void pci_add_resource(struct list_head *resources, struct resource *res) +struct resource_entry *pci_add_resource(struct list_head *resources, + struct resource *res) { - pci_add_resource_offset(resources, res, 0); + return pci_add_resource_offset(resources, res, 0); } EXPORT_SYMBOL(pci_add_resource); diff --git a/include/linux/pci.h b/include/linux/pci.h index eb3da1a..ab16abe 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1167,9 +1167,11 @@ void pci_release_selected_regions(struct pci_dev *, int); /* drivers/pci/bus.c */ struct pci_bus *pci_bus_get(struct pci_bus *bus); void pci_bus_put(struct pci_bus *bus); -void pci_add_resource(struct list_head *resources, struct resource *res); -void pci_add_resource_offset(struct list_head *resources, struct resource *res, - resource_size_t offset); +struct resource_entry *pci_add_resource(struct list_head *resources, + struct resource *res); +struct resource_entry *pci_add_resource_offset(struct list_head *resources, + struct resource *res, + resource_size_t offset); void pci_free_resource_list(struct list_head *resources); void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);