From patchwork Thu Oct 8 21:38:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 7355651 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 494DB9F4DC for ; Thu, 8 Oct 2015 21:42:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 609C12043C for ; Thu, 8 Oct 2015 21:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86E2820555 for ; Thu, 8 Oct 2015 21:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753164AbbJHVmc (ORCPT ); Thu, 8 Oct 2015 17:42:32 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:28530 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933851AbbJHVmL (ORCPT ); Thu, 8 Oct 2015 17:42:11 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t98LdwGw002513 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Oct 2015 21:39:58 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t98Ldvg6020467 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 8 Oct 2015 21:39:58 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t98Ldvpg009803; Thu, 8 Oct 2015 21:39:57 GMT Received: from linux-siqj.site (/10.132.127.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Oct 2015 14:39:57 -0700 From: Yinghai Lu To: Bjorn Helgaas , David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang , Khalid Aziz Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v7 34/60] PCI: Simplify res reference using in __assign_resources_sorted() Date: Thu, 8 Oct 2015 14:38:53 -0700 Message-Id: <1444340359-8011-35-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1444340359-8011-1-git-send-email-yinghai@kernel.org> References: <1444340359-8011-1-git-send-email-yinghai@kernel.org> X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 There are couples of dev_res->res reference, to make code more readable use res instead of dev_res->res directly. Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index c9dfd1c..d575c56 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -458,6 +458,7 @@ static void __assign_resources_sorted(struct list_head *head, struct pci_dev_resource *dev_res, *tmp_res; unsigned long fail_type; resource_size_t add_align; + struct resource *res; /* Check if optional add_size is there */ if (!realloc_head || list_empty(realloc_head)) @@ -473,8 +474,8 @@ static void __assign_resources_sorted(struct list_head *head, /* Update res in head list with add_size in realloc_head list */ list_for_each_entry(dev_res, head, list) { - dev_res->res->end += get_res_add_size(realloc_head, - dev_res->res); + res = dev_res->res; + res->end += get_res_add_size(realloc_head, res); /* * There are two kinds of additional resources in the list: @@ -483,16 +484,16 @@ static void __assign_resources_sorted(struct list_head *head, * 2. resource with IORESOURCE_SIZEALIGN * update size above already change alignment. */ - if (!(dev_res->res->flags & IORESOURCE_STARTALIGN)) + if (!(res->flags & IORESOURCE_STARTALIGN)) continue; - add_align = get_res_add_align(realloc_head, dev_res->res); + add_align = get_res_add_align(realloc_head, res); if (add_align) { - resource_size_t r_size = resource_size(dev_res->res); + resource_size_t r_size = resource_size(res); - dev_res->res->start = add_align; - dev_res->res->end = add_align + r_size - 1; + res->start = add_align; + res->end = add_align + r_size - 1; } } @@ -514,21 +515,21 @@ static void __assign_resources_sorted(struct list_head *head, /* check failed type */ fail_type = pci_fail_res_type_mask(&local_fail_head); /* remove not need to be released assigned res from head list etc */ - list_for_each_entry_safe(dev_res, tmp_res, head, list) - if (dev_res->res->parent && - !pci_need_to_release(fail_type, dev_res->res)) { + list_for_each_entry_safe(dev_res, tmp_res, head, list) { + res = dev_res->res; + if (res->parent && !pci_need_to_release(fail_type, res)) { /* remove it from realloc_head list */ - remove_from_list(realloc_head, dev_res->res); - remove_from_list(&save_head, dev_res->res); + remove_from_list(realloc_head, res); + remove_from_list(&save_head, res); list_del(&dev_res->list); kfree(dev_res); } + } free_list(&local_fail_head); /* Release assigned resource */ list_for_each_entry(dev_res, head, list) { - struct resource *res = dev_res->res; - + res = dev_res->res; if (res->parent) { dev_printk(KERN_DEBUG, &dev_res->dev->dev, "BAR %d: released %pR\n", @@ -539,8 +540,7 @@ static void __assign_resources_sorted(struct list_head *head, } /* Restore start/end/flags from saved list */ list_for_each_entry(save_res, &save_head, list) { - struct resource *res = save_res->res; - + res = save_res->res; res->start = save_res->start; res->end = save_res->end; res->flags = save_res->flags;